-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
52 lines (40 loc) · 1.43 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
GOBASEPATH=$(shell go env var GOPATH | xargs)
help: ## Show this help.
@egrep -h '\s##\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'
.PHONY:build
build: ## Build tzf server
go build
.PHONY:test
test: ## Run test
go test -json -race ./... -v -coverprofile=coverage.txt -covermode=atomic | tparse -all
.PHONY:bench
bench: ## Run benchmark
go test -bench=. -benchmem ./...
.PHONY:cover
cover: ## Generate coverage report
go tool cover -html=coverage.txt -o=coverage.html
mock: ## Generate mock
mockgen -source=$(GOBASEPATH)/pkg/mod/github.com/tidwall/redcon@v1.6.2/redcon.go -destination="internal/redisserver/mock_redcon_test.go" -package=redisserver_test
install: ## Install tools
go install github.com/mfridman/tparse@latest
go install go.uber.org/mock/mockgen@latest
go install github.com/wolfogre/gtag/cmd/gtag@latest
go install github.com/google/wire/cmd/wire@latest
go install github.com/favadi/protoc-go-inject-tag@latest
go install github.com/ringsaturn/protoc-gen-go-hertz@latest
.PHONY:pb
pb: ## Generate protobuf
buf build
buf generate
protoc-go-inject-tag -input="tzf/v1/*.pb.go" -remove_tag_comment
go fmt ./...
fmt: ## Format code
find proto/v1 -iname *.proto | xargs clang-format -i --style=Google
go fmt ./...
go fix ./...
gtag: ## Generate gtag
cd internal/config;gtag -types Config -tags flag .
gen: ## Generate code
make pb
make mock
make gtag