mirror of
https://github.com/prometheus/prometheus
synced 2024-12-24 07:23:02 +00:00
Add staticcheck to build.
This commit is contained in:
parent
923be6a418
commit
0fcfe3209f
18
Makefile
18
Makefile
@ -14,6 +14,7 @@
|
|||||||
GO := GO15VENDOREXPERIMENT=1 go
|
GO := GO15VENDOREXPERIMENT=1 go
|
||||||
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
|
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
|
||||||
PROMU := $(FIRST_GOPATH)/bin/promu
|
PROMU := $(FIRST_GOPATH)/bin/promu
|
||||||
|
STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck
|
||||||
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
|
pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
|
||||||
|
|
||||||
PREFIX ?= $(shell pwd)
|
PREFIX ?= $(shell pwd)
|
||||||
@ -25,8 +26,15 @@ ifdef DEBUG
|
|||||||
bindata_flags = -debug
|
bindata_flags = -debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
STATICCHECK_IGNORE = \
|
||||||
|
github.com/prometheus/prometheus/discovery/kubernetes/node.go:SA1019 \
|
||||||
|
github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/main.go:SA1019 \
|
||||||
|
github.com/prometheus/prometheus/storage/local/codable/codable.go:SA6002 \
|
||||||
|
github.com/prometheus/prometheus/storage/local/persistence.go:SA6002 \
|
||||||
|
github.com/prometheus/prometheus/storage/remote/queue_manager.go:SA1015 \
|
||||||
|
github.com/prometheus/prometheus/web/web.go:SA1019
|
||||||
|
|
||||||
all: format build test
|
all: format staticcheck build test
|
||||||
|
|
||||||
style:
|
style:
|
||||||
@echo ">> checking code style"
|
@echo ">> checking code style"
|
||||||
@ -52,6 +60,10 @@ vet:
|
|||||||
@echo ">> vetting code"
|
@echo ">> vetting code"
|
||||||
@$(GO) vet $(pkgs)
|
@$(GO) vet $(pkgs)
|
||||||
|
|
||||||
|
staticcheck: $(STATICCHECK)
|
||||||
|
@echo ">> running staticcheck"
|
||||||
|
@$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
|
||||||
|
|
||||||
build: promu
|
build: promu
|
||||||
@echo ">> building binaries"
|
@echo ">> building binaries"
|
||||||
@$(PROMU) build --prefix $(PREFIX)
|
@$(PROMU) build --prefix $(PREFIX)
|
||||||
@ -76,5 +88,7 @@ promu:
|
|||||||
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
|
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
|
||||||
$(GO) get -u github.com/prometheus/promu
|
$(GO) get -u github.com/prometheus/promu
|
||||||
|
|
||||||
|
$(FIRST_GOPATH)/bin/staticcheck:
|
||||||
|
@GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck
|
||||||
|
|
||||||
.PHONY: all style check_license format build test vet assets tarball docker promu
|
.PHONY: all style check_license format build test vet assets tarball docker promu staticcheck $(FIRST_GOPATH)/bin/staticcheck
|
||||||
|
Loading…
Reference in New Issue
Block a user