英文:
go import github, how to set up?
问题
你好!以下是你要翻译的内容:
尝试运行一个Go测试代码时遇到了问题。
它的导入语句如下:
"github.com/abcd/abcd"
然后,当我运行它时,它找不到该包。
我注意到这是一种常见的导入GitHub库的做法。
对我来说,正确的处理方式是什么?
谢谢。
英文:
trying to run a go test code and have this issue.
It has import like this:
"github.com/abcd/abcd"
Then, when I run it, it failed to find the package.
I noticed this is a common practice to import github stuff like this.
For me, what is the right the way to handle it?
thanks.
答案1
得分: 2
这将在您的gopath中下载存储库。
mkdir -P $PWD/gopath/{bin,src,pkg}
export GOPATH=$PWD/gopath:$GOPATH
go get "github.com/abcd/abcd"
ls gopath/src/github.com/abcd/abcd
如果您告诉我们具体的存储库,我们可以提供更准确的信息来完成您的任务。
英文:
This should download the repository inside your gopath
mkdir -P $PWD/gopath/{bin,src,pkg}
export GOPATH=$PWD/gopath:$GOPATH
go get "github.com/abcd/abcd"
ls gopath/src/github.com/abcd/abcd
If you tell us what specific repository you may get more accurate info on how to accomplish your task
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论