golang go get无法识别导入路径。

huangapple go评论88阅读模式
英文:

golang go get unrecognized import path

问题

当我尝试在golang项目的根路径ChaatzFeaturePhoneServer中运行go get时,它提示:

  go get
  package FeaturePhoneServer/routers: unrecognized import path "FeaturePhoneServer/routers"

我对此感到相当困惑。可能的原因是什么?我该如何找出原因并修复它?

英文:

When I tried to run go get in a golang project root path ChaatzFeaturePhoneServer. It prompts

  go get
  package FeaturePhoneServer/routers: unrecognized import path "FeaturePhoneServer/routers"

I am rather confused about it. What is the possible cause of it? How can I find out the cause and fix it?

答案1

得分: 6

请检查您的GOPATH环境变量:

go期望在$GOPATH/src中找到FeaturePhoneServer/routers(参见go build)。
避免使用相对导入路径避免相对导入路径

如果错误仍然存在,您还可以检查您的GOROOT和go安装,如此问题中所述

英文:

Check your GOPATH environment variable:

go expect to find FeaturePhoneServer/routers in $GOPATH/src (see go build)
Avoid relative import paths.

If the error persists, you can also check your GOROOT and go installation, as in this question.

huangapple
  • 本文由 发表于 2014年8月19日 00:45:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/25368148.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定