File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,21 @@ BUILD_FILES = $(shell go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}}\
22{{end}}' ./...)
33
44GH_VERSION ?= $(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD)
5+ DATE_FMT = +%Y-%m-%d
6+ ifdef SOURCE_DATE_EPOCH
7+ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH ) " "$(DATE_FMT ) " 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH ) " "$(DATE_FMT ) " 2>/dev/null || date -u "$(DATE_FMT ) ")
8+ else
9+ BUILD_DATE ?= $(shell date "$(DATE_FMT ) ")
10+ endif
511LDFLAGS := -X github.com/cli/cli/command.Version=$(GH_VERSION ) $(LDFLAGS )
6- LDFLAGS := -X github.com/cli/cli/command.BuildDate=$(shell date + % Y- % m- % d ) $(LDFLAGS )
12+ LDFLAGS := -X github.com/cli/cli/command.BuildDate=$(BUILD_DATE ) $(LDFLAGS )
713ifdef GH_OAUTH_CLIENT_SECRET
814 LDFLAGS := -X github.com/cli/cli/context.oauthClientID=$(GH_OAUTH_CLIENT_ID) $(LDFLAGS)
915 LDFLAGS := -X github.com/cli/cli/context.oauthClientSecret=$(GH_OAUTH_CLIENT_SECRET) $(LDFLAGS)
1016endif
1117
1218bin/gh : $(BUILD_FILES )
13- @go build -ldflags " $( LDFLAGS) " -o " $@ " ./cmd/gh
19+ @go build -trimpath - ldflags " $( LDFLAGS) " -o " $@ " ./cmd/gh
1420
1521test :
1622 go test ./...
You can’t perform that action at this time.
0 commit comments