简体   繁体   English

去导入github,如何设置?

[英]go import github, how to set up?

trying to run a go test code and have this issue. 尝试运行go测试代码并遇到此问题。 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. 我注意到这是导入github这样的东西的常见做法。 For me, what is the right the way to handle it? 对我来说,正确的处理方式是什么?

thanks. 谢谢。

This should download the repository inside your gopath 这应该在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 如果您告诉我们特定的存储库,则可能会获得有关如何完成任务的更准确的信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM