How do I use github packages in go?

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

How do I use github packages in go?

问题

抱歉,非常初学者的golang问题。我有一个名为journalbeat的github项目,我正在修改它。

当我克隆该存储库时,我可以设置GOPATH并运行go get来获取所有的导入包,并将它们放入src目录。

我想添加一个新的导入包。

import "github.com/danwakefield/fnmatch"

但它没有被获取。运行go get如何确定是否已下载某个包?

最后,使用了供应商系统。我如何将fnmatch添加到供应商目录中?我需要手动创建吗?这一切看起来都很繁琐。

我以为go get应该使所有这些变得容易?

英文:

Sorry, very much a newbie golang question. I have a github project named journalbeat that I am modifying.

When I clone that repository I can set the GOPATH and run go get to grab all the imports and it places them into src.

I have a new import I want to add.

import "github.com/danwakefield/fnmatch"

but it doesn't grab it. How does simply running go get determine whether something is downloaded or not?

And finally, the vendoring system is used. How do I populate that with the fnmatch? do I create it manually? it all seems very cumbersome.

I thought go get was meant to make all this easy?

答案1

得分: 3

尝试使用一个依赖管理器:最新且活跃开发的一个是golang/dep
根据dep的问题943,使用以下命令:

dep ensure

这将通过导入分析设置供应商依赖项,并且如果需要的话,你可以配置锁定这些依赖项。

英文:

Try instead a dependency manager: the most recent and actively developed one is golang/dep.
Reading dep "issue" 943, use:

dep ensure

That will set up vendored dependencies through import analysis, and you can configure locking those down if need be.

答案2

得分: 0

尝试使用带有详细信息标志-vgo get命令,例如:

go get -v github.com/danwakefield/fnmatch

这将显示更多详细信息。请将结果发布在这里。

英文:

Try go get with the verbose flag -v like:

go get -v github.com/danwakefield/fnmatch

This will show you more details. Post the result here.

答案3

得分: 0

我们使用Glide包管理工具来管理GO语言的依赖。快去查看吧 GitHub链接

英文:

we use Glide package management tool for GO. Go check it out gitHub link

huangapple
  • 本文由 发表于 2017年8月4日 12:28:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/45498274.html
匿名

发表评论

匿名网友

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

确定