diff --git a/README.md b/README.md index 3847e798..f19f63b2 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,11 @@ Local installation is not recommended for your CI pipeline. Only install the lin go get -u github.com/golangci/golangci-lint/cmd/golangci-lint ``` +With `go1.11` or later you can get a particular version +```bash +GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.14.1 +``` + #### MacOS You can also install it on MacOS using [brew](https://brew.sh/): diff --git a/README.tmpl.md b/README.tmpl.md index 549af438..a9a97234 100644 --- a/README.tmpl.md +++ b/README.tmpl.md @@ -96,6 +96,11 @@ Local installation is not recommended for your CI pipeline. Only install the lin go get -u github.com/golangci/golangci-lint/cmd/golangci-lint ``` +With `go1.11` or later you can get a particular version +```bash +GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.14.1 +``` + #### MacOS You can also install it on MacOS using [brew](https://brew.sh/): diff --git a/cmd/golangci-lint/mod_version.go b/cmd/golangci-lint/mod_version.go new file mode 100644 index 00000000..16f7493c --- /dev/null +++ b/cmd/golangci-lint/mod_version.go @@ -0,0 +1,18 @@ +// +build go1.12 + +package main + +import ( + "fmt" + "runtime/debug" +) + +func init() { + if info, available := debug.ReadBuildInfo(); available { + if date == "" && info.Main.Version != "(devel)" { + version = info.Main.Version + commit = fmt.Sprintf("(unknown, mod sum: %q)", info.Main.Sum) + date = "(unknown)" + } + } +}