-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
35 lines (28 loc) · 894 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
COVER_FILE ?= coverage.out
.PHONY: default
default: lint test
.PHONY: lint
lint: ## Check the project with lint.
@golangci-lint run -v --fix
.PHONY: test
test: ## Run unit tests
@go test ./... -coverprofile=$(COVER_FILE)
@go tool cover -func=$(COVER_FILE) | grep ^total
.PHONY: test-race
test-race: ## Run unit test and race detector.
@go test -race ./... -coverprofile=$(COVER_FILE)
.PHONY: cover
cover: $(COVER_FILE) ## Output coverage in human readable form in html
@go tool cover -html=$(COVER_FILE)
@rm -f $(COVER_FILE)
.PHONY: mod
mod: ## Manage go mod dependencies, beautify go.mod and go.sum files.
@go mod tidy
.PHONY: help
help: ## Prints this help message
@echo "Commands:"
@grep -F -h '##' $(MAKEFILE_LIST) \
| grep -F -v fgrep \
| sort \
| grep -E '^[a-zA-Z_-]+:.*?## .*$$' \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'