Add version information to built artifact when go get with go1.12
This commit is contained in:
parent
deb63b191f
commit
1eb712544c
@ -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/):
|
||||
|
@ -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/):
|
||||
|
18
cmd/golangci-lint/mod_version.go
Normal file
18
cmd/golangci-lint/mod_version.go
Normal file
@ -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)"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user