3

How to get the specified version(tag) of package by using go get?

go get github.com/owner/repo

In the above command, how to specify version or tag of the package.

HeadwindFly
  • 774
  • 3
  • 8
  • 19
  • 1
    [This question](http://stackoverflow.com/questions/24855081/how-do-i-import-a-specific-version-of-a-package-using-go-get) is related to your question. – putu Sep 29 '16 at 04:28
  • Related, read this initiative: [Gophers, please tag your releases](http://dave.cheney.net/2016/06/24/gophers-please-tag-your-releases) – icza Sep 29 '16 at 06:08

1 Answers1

6

Volker's correct, but here's a way to use a particular version in your project:

go get github.com/sirupsen/logrus
cd $GOPATH/src/github.com/sirupsen/logrus
git checkout v0.9.0
cd $GOPATH/src/github.com/YOU/PROJECT
govendor add github.com/sirupsen/logrus  # or similar
Plato
  • 10,812
  • 2
  • 41
  • 61
  • Don't forget to `go install ./...` after `git checkout` if the module contains tools like `protoc` – rustyx Aug 31 '20 at 16:16