aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 43932609e11f29630d7f4d5730c5c120ca3b649f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
GOPATH?=	$(HOME)/go

.PHONY: test
test: lint ## Run tests and create coverage report
	go test -race -short -coverprofile=coverage.txt -covermode=atomic ./...
	go tool cover -html=coverage.txt -o coverage.html

.PHONY: lint
lint: $(GOPATH)/bin/golint ## Run the code linter
	@for file in $$(find . -name 'vendor' -prune -o -type f -name '*.go'); do \
		golint $$file; done

$(GOPATH)/bin/golint:
	go get -u golang.org/x/lint/golint

.PHONY: clean
clean: ## Clean up temp files and binaries
	@rm -rf coverage*

.PHONY: help
help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) |sort \
		|awk 'BEGIN{FS=":.*?## "};{printf "\033[36m%-30s\033[0m %s\n",$$1,$$2}'