go import github, how to set up?

huangapple go评论92阅读模式
英文:

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

huangapple
  • 本文由 发表于 2014年8月27日 09:31:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/25517593.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定