diff --git a/Makefile b/Makefile index 38ce39b1a..e5aa96259 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ .PHONY: vendor docs mocks GO_PACKAGES=$(shell go list ./...) GO ?= $(shell command -v go 2> /dev/null) -BUILD_HASH = $(shell git rev-parse HEAD) +BUILD_HASH ?= $(shell git rev-parse HEAD) +BUILD_VERSION ?= $(shell git ls-remote --tags --refs --sort="v:refname" git://github.com/mattermost/mmctl | tail -n1 | sed 's/.*\///') +# Needed to avoid install shadow in brew which is not permitted +ADVANCED_VET ?= TRUE LDFLAGS += -X "github.com/mattermost/mmctl/commands.BuildHash=$(BUILD_HASH)" +LDFLAGS += -X "github.com/mattermost/mmctl/commands.Version=$(BUILD_VERSION)" all: build @@ -48,9 +52,11 @@ gofmt: govet: @echo Running govet - env GO111MODULE=off $(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow $(GO) vet $(GO_PACKAGES) +ifeq ($(ADVANCED_VET), TRUE) + env GO111MODULE=off $(GO) get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow $(GO) vet -vettool=$(GOPATH)/bin/shadow $(GO_PACKAGES) +endif @echo Govet success test: test-unit