-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (41 loc) · 1.34 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## PROLOG
.PHONY: help all
CMDNAME=governor
CMDDESC=go service framework
help: ## Print this help
@./help.sh '$(CMDNAME)' '$(CMDDESC)'
all: test ## Default
## TESTS
TEST_ARGS?=
TEST_PACKAGE?=./...
COVERAGE_OUT?=cover.out
COVERAGE_HTML?=coverage.html
COVERAGE_ARGS=-cover -covermode atomic -coverprofile $(COVERAGE_OUT)
.PHONY: test testunit testcover testcoverunit coverage cover coverunit
test: ## Run all tests
./test.sh $(TEST_ARGS) $(TEST_PACKAGE)
testunit: ## Runs unit tests
go test -trimpath -ldflags "-w -s" -race -short $(TEST_ARGS) $(TEST_PACKAGE)
testcover: ## Run all tests with coverage
./test.sh $(COVERAGE_ARGS) $(TEST_ARGS) $(TEST_PACKAGE)
testcoverunit: ## Run unit tests with coverage
go test -trimpath -ldflags "-w -s" -race -short $(COVERAGE_ARGS) $(TEST_ARGS) $(TEST_PACKAGE)
coverage: ## Create coverage report
go tool cover -html $(COVERAGE_OUT) -o $(COVERAGE_HTML)
cover: testcover coverage ## Test with coverage
coverunit: testcoverunit coverage ## Test with coverage
## FMT
.PHONY: fmt vet prepare
fmt: ## Format code
goimports -w .
vet: ## Lint code
go vet ./...
prepare: fmt vet ## Prepare code for PR
## CODEGEN
GENSRC=$(shell find . -name '*_gen.go')
.PHONY: generate gen cleangen
generate: ## Run go generate
go generate ./...
gen: generate fmt ## Run codegen
cleangen: ## Remove generated code
rm $(GENSRC)