1# Directory to place `go install`ed binaries into. 2export GOBIN ?= $(shell pwd)/bin 3 4GOLINT = $(GOBIN)/golint 5 6GO_FILES ?= *.go 7 8.PHONY: build 9build: 10 go build ./... 11 12.PHONY: test 13test: 14 go test -race ./... 15 16.PHONY: gofmt 17gofmt: 18 $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) 19 gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true 20 @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" && cat $(FMT_LOG) && false) 21 22$(GOLINT): 23 go install golang.org/x/lint/golint 24 25.PHONY: golint 26golint: $(GOLINT) 27 $(GOLINT) ./... 28 29.PHONY: lint 30lint: gofmt golint 31 32.PHONY: cover 33cover: 34 go test -coverprofile=cover.out -coverpkg ./... -v ./... 35 go tool cover -html=cover.out -o cover.html 36