-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (49 loc) · 1.46 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
setup: # Setup dependencies
go mod tidy
go generate ./...
.PHONY: setup
format: # Run gofmt
go fmt ./...
.PHONY: format
lint: # Run linter
golangci-lint run ./...
.PHONY: lint
test: # Test uses race and coverage
go clean -testcache && go test -race -coverprofile=coverage.out -covermode=atomic
.PHONY: test
test-v: # Test with -v
go clean -testcache && go test -race -v $$(go list ./... | $(excluded)) -coverprofile=coverage.out -covermode=atomic
.PHONY: test-v
cover: test # Run all the tests and opens the coverage report
go tool cover -html=coverage.out
.PHONY: cover
bench: # Runs benchmarks
go test -benchmem -bench . -run=^#
.PHONY: bench
mock: # Make mocks keeping directory tree
rm -rf mocks \
&& mockery --name=Encoder --recursive --exported=true --output=./mocks \
&& mockery --name=RedisStore --recursive --exported=true --output=./mocks
.PHONY: mock
doc: # Run go doc
godoc -http localhost:8080
.PHONY: doc
all: # Make format, lint and test
$(MAKE) format
$(MAKE) lint
$(MAKE) test
.PHONY: all
todo: # Show to-do items per file
$(Q) grep \
--exclude=Makefile.util \
--exclude-dir=vendor \
--exclude-dir=.idea \
--text \
--color \
-nRo \
-E '\S*[^\.]TODO.*' \
.
.PHONY: todo
help: # Display this help
$(Q) awk 'BEGIN {FS = ":.*#"; printf "Usage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?#/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help