如何使用go get检出一个发布版本?

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

How to checkout a release with go get?

问题

我一直在尝试使用go get github.com/xxx/xxx安装一个模块。以前它很容易安装,但维护者发布了一个新版本,现在对我来说不起作用了。我想知道是否有办法安装以前的版本?默认情况下,它会安装主分支。是否有任何标志可以像go get github.com/xxx/xxx --branch=xxx这样指定分支信息?

英文:

I have been trying to install a module using go get github.com/xxx/xxx. It used to get installed easily previously, but the maintainers release a new release and it's not working for me anymore. I am looking to know if there is any way I can get the previous release to install? By default it is installing the master branch. Is there any flag where I can put the branch info like go get github.com/xxx/xxx --branch=xxx?

答案1

得分: 4

不,你需要使用一个可以处理分支和版本冻结的外部依赖管理工具。然后你可以使用它来替代直接调用go get命令,这个工具因工具而异,你可以冻结版本。以下是一些流行的工具:

  1. Godep(我个人使用):https://github.com/tools/godep

  2. Nut:https://github.com/jingweno/nut

  3. Gopm:https://github.com/gpmgo/gopm

  4. 一些库使用gopkg.in,它将版本嵌入到导入URL中。http://labix.org/gopkg.in 这样可以直接使用go-get,但这取决于库是否通过gopkg发布

英文:

No, you'll need to use an external dependency management tool that can handle branch and version freezes. Then you use it instead of calling go get directly - this changes from tool to tool - and you can freeze versions. A few popular tools:

  1. Godep (I personally use it): https://github.com/tools/godep

  2. Nut https://github.com/jingweno/nut

  3. Gopm https://github.com/gpmgo/gopm

  4. Some libraries use gopkg.in which embeds vesions into the import urls. http://labix.org/gopkg.in This does allow to use go-get directly, but it depends on whether the libraries are released via gopkg

答案2

得分: 1

你可以fork这个库,并决定是否将新版本合并到你的fork中。如果新版本破坏了你的应用程序,你还可以回滚到之前的版本。

英文:

You can fork the library and decide if you want to pull new versions to your fork. And roll back if the new version break you application.

huangapple
  • 本文由 发表于 2015年10月8日 22:17:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/33018414.html
匿名

发表评论

匿名网友

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

确定