2020-08-09 15:29:54 -07:00
|
|
|
# Directory to place `go install`ed binaries into.
|
|
|
|
export GOBIN ?= $(shell pwd)/bin
|
2018-11-18 09:55:05 -08:00
|
|
|
|
2020-08-09 15:29:54 -07:00
|
|
|
GOLINT = $(GOBIN)/golint
|
2018-11-18 09:55:05 -08:00
|
|
|
|
2020-08-09 15:29:54 -07:00
|
|
|
GO_FILES ?= *.go
|
2018-11-18 09:55:05 -08:00
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build:
|
2020-08-09 15:29:54 -07:00
|
|
|
go build ./...
|
2018-11-18 09:55:05 -08:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
2020-08-09 15:29:54 -07:00
|
|
|
go test -race ./...
|
2018-11-18 09:55:05 -08:00
|
|
|
|
2020-08-09 15:29:54 -07:00
|
|
|
.PHONY: gofmt
|
|
|
|
gofmt:
|
|
|
|
$(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX))
|
|
|
|
gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true
|
|
|
|
@[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" && cat $(FMT_LOG) && false)
|
2018-11-18 09:55:05 -08:00
|
|
|
|
2020-08-09 15:29:54 -07:00
|
|
|
$(GOLINT):
|
|
|
|
go install golang.org/x/lint/golint
|
2019-06-16 14:33:25 -07:00
|
|
|
|
2020-08-09 15:29:54 -07:00
|
|
|
.PHONY: golint
|
|
|
|
golint: $(GOLINT)
|
|
|
|
$(GOLINT) ./...
|
2018-11-18 09:55:05 -08:00
|
|
|
|
|
|
|
.PHONY: lint
|
2020-08-09 15:29:54 -07:00
|
|
|
lint: gofmt golint
|
|
|
|
|
|
|
|
.PHONY: cover
|
|
|
|
cover:
|
|
|
|
go test -coverprofile=cover.out -coverpkg ./... -v ./...
|
|
|
|
go tool cover -html=cover.out -o cover.html
|