diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 49 |
1 files changed, 26 insertions, 23 deletions
@@ -1,39 +1,42 @@ -GOLINT = go run golang.org/x/lint/golint -STATICCHECK = go run honnef.co/go/tools/cmd/staticcheck +export GOBIN = $(shell pwd)/bin +export PATH := $(GOBIN):$(PATH) -.PHONY: all -all: test +GOLINT = bin/golint +STATICCHECK = bin/staticcheck -.PHONY: build -build: - go build +TEST_FLAGS ?= -race -.PHONY: install -install: - go install . +.PHONY: all +all: lint install test .PHONY: lint -lint: - $(GOLINT) ./... - -.PHONY: vet -vet: - go vet ./... +lint: golint staticcheck .PHONY: staticcheck -staticcheck: - $(STATICCHECK) -tests=false ./... +staticcheck: $(STATICCHECK) + $(STATICCHECK) ./... -.PHONY: pretest -pretest: lint vet staticcheck +$(STATICCHECK): tools/go.mod + cd tools && go install honnef.co/go/tools/cmd/staticcheck + +.PHONY: golint +golint: $(GOLINT) + $(GOLINT) ./... + +$(GOLINT): tools/go.mod + cd tools && go install golang.org/x/lint/golint + +.PHONY: install +install: + go install . .PHONY: test -test: pretest - go test -race ./... +test: + go test $(TEST_FLAGS) ./... .PHONY: cover cover: - go test -coverprofile=cover.out -covermode=atomic -coverpkg=./... ./... + go test $(TEST_FLAGS) -coverprofile=cover.out -covermode=atomic -coverpkg=./... ./... go tool cover -html=cover.out -o cover.html .PHONY: clean |