简体   繁体   中英

How to checkout a release with go get?

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 ?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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