Skip to content

Commit 71ba8ef

Browse files
authored
Set version var during make build (#651)
1 parent 01afc31 commit 71ba8ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
CODE_COVERAGE_REPORT_FOLDER = $(PWD)/build/test-coverage
22
CODE_COVERAGE_REPORT_NAME_UNIT = $(CODE_COVERAGE_REPORT_FOLDER)/coverage-unit-report
3+
VERSION_IMPORT_PATH = github.com/elastic/elastic-package/internal/version
34

45
.PHONY: build
56

67
build:
7-
go get -ldflags "-X github.com/elastic/elastic-package/internal/version.CommitHash=`git describe --always --long --dirty` -X github.com/elastic/elastic-package/internal/version.BuildTime=`date +%s`" \
8+
go install -ldflags \
9+
"-X $(VERSION_IMPORT_PATH).CommitHash=`git describe --always --long --dirty` -X $(VERSION_IMPORT_PATH).BuildTime=`date +%s` -X $(VERSION_IMPORT_PATH).Tag=`(git describe --exact-match --tags 2>/dev/null || echo '') | tr -d '\n'`" \
810
github.com/elastic/elastic-package
911

1012
clean:

0 commit comments

Comments
 (0)