Set version in Makefile when installing
This commit is contained in:
parent
0b86ec0579
commit
e198d3eb36
5
Makefile
5
Makefile
|
|
@ -3,6 +3,9 @@
|
||||||
# violations already in the code). They can be useful to catch errors, but
|
# violations already in the code). They can be useful to catch errors, but
|
||||||
# they are just too noisy to be a requirement for a CI -- we don't even *want*
|
# they are just too noisy to be a requirement for a CI -- we don't even *want*
|
||||||
# to fix some of the things they consider to be violations.
|
# to fix some of the things they consider to be violations.
|
||||||
|
|
||||||
|
version=$(shell git describe --always --dirty)
|
||||||
|
|
||||||
.PHONY: ci
|
.PHONY: ci
|
||||||
ci: deps checkgofmt vet staticcheck unused ineffassign predeclared test
|
ci: deps checkgofmt vet staticcheck unused ineffassign predeclared test
|
||||||
|
|
||||||
|
|
@ -16,7 +19,7 @@ updatedeps:
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
go install ./...
|
go install -ldflags '-X "main.version=dev build $(version)"' ./...
|
||||||
|
|
||||||
.PHONY: checkgofmt
|
.PHONY: checkgofmt
|
||||||
checkgofmt:
|
checkgofmt:
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ func main() {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
if *printVersion {
|
if *printVersion {
|
||||||
fmt.Fprintf(os.Stderr, "%s v%s\n", os.Args[0], version)
|
fmt.Fprintf(os.Stderr, "%s %s\n", os.Args[0], version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue