1 # A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
3 .PHONY: check fmt lint test test-race vet test-cover-html help
6 check: test-race fmt vet lint ## Run tests and linters
11 test-race: ## Run tests with race detector
14 fmt: ## Run gofmt linter
15 @for d in `go list` ; do \
16 if [ "`gofmt -l -s $$GOPATH/src/$$d | tee /dev/stderr`" ]; then \
17 echo "^ improperly formatted go files" && echo && exit 1; \
21 lint: ## Run golint linter
22 @for d in `go list` ; do \
23 if [ "`golint $$d | tee /dev/stderr`" ]; then \
24 echo "^ golint errors!" && echo && exit 1; \
28 vet: ## Run go vet linter
29 @if [ "`go vet | tee /dev/stderr`" ]; then \
30 echo "^ go vet errors!" && echo && exit 1; \
33 test-cover-html: ## Generate test coverage report
34 go test -coverprofile=coverage.out -covermode=count
35 go tool cover -func=coverage.out
38 @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'