How to do “go get” on a specific tag of a github repository

前端 未结 6 1556
孤街浪徒
孤街浪徒 2020-12-13 03:35

I am trying to compile the InfluxDB database (version v0.8.8) using go get github.com/influxdb/influxdb

But this pulls the master branch, and I need the

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 03:46

    I have a (somewhat hackish, but working) approach to address this problem, at least for git repositories: As go get'ed packages are normal source control repositories, one can check out tags using normal git tools (could use git from command line, I am using Atlassian SourceTree).

    To share my package configuration with my teammates, I have made a git repository out ouf my GOPATH. I then added all packages (at least the ones I wanted to manage this way) to this repo as git submodule. This requires you to move the exising repo folders out of the way and re-add them as git submodule, to not confuse git. This process is somewhat tedious, but proved to be worth the trouble:

    I can now commit and push to my GOPATH-repo every timy I use a new go package. When my teammates pull from this repo and issue a git submodule update (or simply update via SoureTree, which does this automatically), their version of the package gets checked out on the same tag as mine is.

    Of course this does only work for packages under git source control...

提交回复
热议问题