1313
1414GO ?= GO15VENDOREXPERIMENT=1 go
1515GOPATH := $(firstword $(subst :, ,$(GOPATH ) ) )
16- PROMU ?= $(GOPATH ) /bin/promu
17- pkgs = $(shell $(GO ) list ./... | grep -v /vendor/)
16+
17+ PROMU ?= $(GOPATH ) /bin/promu
18+ STATICCHECK ?= $(GOPATH ) /bin/staticcheck
19+ pkgs = $(shell $(GO ) list ./... | grep -v /vendor/)
1820
1921PREFIX ?= $(shell pwd)
2022BIN_DIR ?= $(shell pwd)
3335 test-e2e := skip-test-e2e
3436endif
3537
36- all : format build test $(test-e2e )
38+ all : format vet staticcheck build test $(test-e2e )
3739
3840style :
3941 @echo " >> checking code style"
5860 @echo " >> vetting code"
5961 @$(GO ) vet $(pkgs )
6062
63+ staticcheck : $(STATICCHECK )
64+ @echo " >> running staticcheck"
65+ @$(STATICCHECK ) $(pkgs )
66+
6167build : $(PROMU )
6268 @echo " >> building binaries"
6369 @$(PROMU ) build --prefix $(PREFIX )
@@ -71,9 +77,10 @@ docker:
7177 @docker build -t " $( DOCKER_IMAGE_NAME) :$( DOCKER_IMAGE_TAG) " .
7278
7379$(GOPATH ) /bin/promu promu :
74- @GOOS=$(shell uname -s | tr A-Z a-z) \
75- GOARCH=$(subst x86_64,amd64,$(patsubst i% 86,386,$(shell uname -m) ) ) \
76- $(GO ) get -u github.com/prometheus/promu
80+ @GOOS= GOARCH= $(GO ) get -u github.com/prometheus/promu
81+
82+ $(GOPATH ) /bin/staticcheck :
83+ @GOOS= GOARCH= $(GO ) get -u honnef.co/go/tools/cmd/staticcheck
7784
7885
79- .PHONY : all style format build test test-e2e vet tarball docker promu $(GOPATH ) /bin/promu
86+ .PHONY : all style format build test test-e2e vet tarball docker promu staticcheck $(GOPATH ) /bin/promu $( GOPATH ) /bin/staticcheck
0 commit comments