这是错误信息:
% go get
can't load package: package .: no buildable Go source files in /Users/7yan00
% echo $GOPATH
/Users/7yan00/Golang
您将如何解决该错误?
最佳答案
确保您在 Go 项目源文件夹中使用该命令(如 /Users/7yan00/Golang/src/myProject
)。
另一种选择(similar to this bug) 是使用 -d
选项(参见 go get
command)
go get -d
The
-d
flag instructs get to stop after downloading the packages; that is, it instructs get not to install the packages.
看看这对你的情况是否有帮助。
但更一般地说,如 in this thread 所述:
go get
is for package(s), not for repositories.so if you want a specific package, say,
go.text/encoding
, then use
go get code.google.com/p/go.text/encoding
if you want all packages in that repository, use
...
to signify that:
go get code.google.com/p/go.text/...
关于go - 无法加载包 : package .:没有可构建的 Go 源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24095004/