Only set version ldflags on tags

This commit is contained in:
Daniel Nelson 2020-06-30 00:49:09 -07:00
parent 9938e08d28
commit 3b54838eca
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
1 changed files with 6 additions and 1 deletions

View File

@ -44,7 +44,12 @@ MAKEFLAGS += --no-print-directory
GOOS ?= $(shell go env GOOS) GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH) GOARCH ?= $(shell go env GOARCH)
HOSTGO := env -u GOOS -u GOARCH -u GOARM -- go HOSTGO := env -u GOOS -u GOARCH -u GOARM -- go
LDFLAGS := $(LDFLAGS) -X main.commit=$(commit) -X main.branch=$(branch) -X main.version=$(version)
LDFLAGS := $(LDFLAGS) -X main.commit=$(commit) -X main.branch=$(branch)
ifneq ($(tag),)
LDFLAGS += -X main.version=$(version)
endif
GOFILES ?= $(shell git ls-files '*.go') GOFILES ?= $(shell git ls-files '*.go')
GOFMT ?= $(shell gofmt -l -s $(filter-out plugins/parsers/influx/machine.go, $(GOFILES))) GOFMT ?= $(shell gofmt -l -s $(filter-out plugins/parsers/influx/machine.go, $(GOFILES)))