diff --git a/Makefile b/Makefile index d82bb84..cd2cc92 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,10 @@ RELEASE_DIR := release # the binary reports dev. TAG ?= $(shell git describe --tags --exact-match 2>/dev/null) VERSION ?= $(patsubst v%,%,$(TAG)) -COMMIT ?= $(shell git rev-parse HEAD 2>/dev/null) +# -dirty when the working tree has changes, as Go itself marks vcs.modified +# (git status --porcelain, untracked files included); empty outside git. +DIRTY := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] || echo -dirty) +COMMIT ?= $(shell git rev-parse HEAD 2>/dev/null)$(DIRTY) BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -ldflags "-s -w -X 'main.version=$(VERSION)' -X 'main.tag=$(TAG)' -X 'main.commit=$(COMMIT)' -X 'main.buildDate=$(BUILD_DATE)'" COVERAGE_MIN := 90