mirror of
https://github.com/mgechev/revive.git
synced 2025-11-29 22:28:23 +02:00
Set all version flags at build time so they have correct values (#593)
This commit is contained in:
@@ -17,6 +17,7 @@ builds:
|
||||
-
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
- BUILDER=GoReleaser
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
|
||||
8
Makefile
8
Makefile
@@ -2,11 +2,17 @@
|
||||
|
||||
export GO111MODULE=on
|
||||
|
||||
GIT_COMMIT ?= $(shell git rev-parse --verify HEAD)
|
||||
GIT_VERSION ?= $(shell git describe --tags --always --dirty="-dev")
|
||||
DATE ?= $(shell date -u '+%Y-%m-%d %H:%M UTC')
|
||||
BUILDER ?= Makefile
|
||||
VERSION_FLAGS := -X "main.version=$(GIT_VERSION)" -X "main.date=$(DATE)" -X "main.commit=$(GIT_COMMIT)" -X "main.builtBy=$(BUILDER)"
|
||||
|
||||
install:
|
||||
@go mod vendor
|
||||
|
||||
build:
|
||||
@go build
|
||||
@go build -ldflags='$(VERSION_FLAGS)'
|
||||
|
||||
test:
|
||||
@go test -v ./...
|
||||
|
||||
Reference in New Issue
Block a user