英文:
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
命令,这个工具因工具而异,你可以冻结版本。以下是一些流行的工具:
-
Godep(我个人使用):https://github.com/tools/godep
-
Nut:https://github.com/jingweno/nut
-
Gopm:https://github.com/gpmgo/gopm
-
一些库使用
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:
-
Godep (I personally use it): https://github.com/tools/godep
-
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论