简体   繁体   English

如何使用go get签出版本?

[英]How to checkout a release with go get?

I have been trying to install a module using go get github.com/xxx/xxx . 我一直在尝试使用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. 默认情况下,它正在安装master分支。 Is there any flag where I can put the branch info like go get github.com/xxx/xxx --branch=xxx ? 有没有可以放置分支信息的标记,例如go get github.com/xxx/xxx --branch=xxx

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. 然后,您可以使用它而不是直接调用go get这在工具之间会发生变化-您可以冻结版本。 A few popular tools: 一些流行的工具:

  1. Godep (I personally use it): https://github.com/tools/godep Godep(我个人使用它): https : //github.com/tools/godep

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

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

  4. Some libraries use gopkg.in which embeds vesions into the import urls. 一些库使用gopkg.in将vesions嵌入到导入URL中。 http://labix.org/gopkg.in This does allow to use go-get directly, but it depends on whether the libraries are released via gopkg http://labix.org/gopkg.in 这确实允许直接使用go-get,但这取决于是否通过gopkg发布了库

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. 如果新版本中断了您的应用程序,请回滚。

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

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