首页 > 解决方案 > How do i make "go get" look in the web rather than on my computer

问题描述

I"m trying to contribute for a project and the docs tell me to use this command

go get github.com/foo/bar 

but the error is

can't load package: package github.com/foo/bar: no Go files in /home/f/go/src/github.com/foo/bar

Obviously its looking on my computer but how do I make it so that it downloads from the web?

标签: go

解决方案


问题是您尝试下载的项目无法构建,因为 Go can't find any source files to build at source path github.com/foo/bar。但是,该软件包下载,如果您查看,$GOPATH/src/github.com/foo/bar您将看到那里克隆的存储库。因此,如果您只想这样,那么您就完成了,但是您可以go get -d在将来使用它来避免错误消息。

如果您想要可以导入的特定内容,例如github.com/foo/bar/somepackage,那么您应该使用go get github.com/foo/bar/somepackage.


推荐阅读