File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ builds:
17
17
-
18
18
env :
19
19
- CGO_ENABLED=0
20
+ - BUILDER=GoReleaser
20
21
goos :
21
22
- linux
22
23
- darwin
Original file line number Diff line number Diff line change 2
2
3
3
export GO111MODULE =on
4
4
5
+ GIT_COMMIT ?= $(shell git rev-parse --verify HEAD)
6
+ GIT_VERSION ?= $(shell git describe --tags --always --dirty="-dev")
7
+ DATE ?= $(shell date -u '+% Y-% m-% d % H:% M UTC')
8
+ BUILDER ?= Makefile
9
+ VERSION_FLAGS := -X "main.version=$(GIT_VERSION ) " -X "main.date=$(DATE ) " -X "main.commit=$(GIT_COMMIT ) " -X "main.builtBy=$(BUILDER ) "
10
+
5
11
install :
6
12
@go mod vendor
7
13
8
14
build :
9
- @go build
15
+ @go build -ldflags= ' $(VERSION_FLAGS) '
10
16
11
17
test :
12
18
@go test -v ./...
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ func init() {
214
214
// Output build info (version, commit, date and builtBy)
215
215
if versionFlag {
216
216
fmt .Printf (
217
- "Current revive version %v commit %v, built @%v by %v. \n " ,
217
+ "Version: \t %s \n Commit: \t \t %s \n Built \t \t %s by %s \n " ,
218
218
version ,
219
219
commit ,
220
220
date ,
You can’t perform that action at this time.
0 commit comments