go - 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 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
.
推荐阅读
- flutter - StackedIndex 导致失败的断言错误
- javascript - 为什么 removeChild 比 innerHTML = ' ' 快?
- wpf - Dependecy 属性用作源但不用作目标
- java - 为了学习 Java,我需要 Java IDE 吗?
- r - R中按行/秒计算的偏移平均值
- r - 如何正确使用 stack() 函数来提取 R 中 ANCOVA 的边际均值?
- java - 错误 Infating 类 com.google.android.material.card.MaterialCardView
- c++ - 在 C++ 中,如何使用在其他地方的一个文件中定义的常量变量?
- c++ - 无法将 GLuint 转换为 GLuint()
- python - 如何整合两个python文件夹?