forked from worldline-go/struct2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
27 lines (19 loc) · 896 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
.DEFAULT_GOAL := help
.PHONY: example test coverage help html html-gen html-wsl
test-data: export DATA ?= ColorGroup
test-data: ## Run data test
@go test -timeout 30s -v -run ^Test_Data$
test: export DATA ?= ColorGroup
test: ## Run unit tests
@go test -race -cover ./...
coverage: ## Run unit tests with coverage
@go test -v -race -cover -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./...
@go tool cover -func=coverage.out
html: ## Show html coverage result
@go tool cover -html=./coverage.out
html-gen: ## Export html coverage result
@go tool cover -html=./coverage.out -o ./coverage.html
html-wsl: html-gen ## Open html coverage result in wsl
@explorer.exe `wslpath -w ./coverage.html` || true
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'