This repository was archived by the owner on Feb 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (46 loc) · 1.37 KB
/
Makefile
File metadata and controls
60 lines (46 loc) · 1.37 KB
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
# Copyright (C) 2020 Yunify, Inc.
VERBOSE = no
.PHONY: help
help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " format to format the code"
@echo " vet to run golang vet"
@echo " lint to run the staticcheck"
@echo " check to format, vet, lint"
@echo " test to run test case"
@echo " compile compile binary program with debug mode"
@echo " release compile binary program with release mode"
@exit 0
COMPILE = _compile() { \
args="$(filter-out $@,$(MAKECMDGOALS))"; \
if [[ $(VERBOSE) = "yes" ]]; then \
bash -x ./scripts/compile.sh $$args; \
else \
bash ./scripts/compile.sh $$args; \
fi \
}
.PHONY: format
format:
@[[ ${VERBOSE} = "yes" ]] && set -x; go fmt ./...;
.PHONY: vet
vet:
@[[ ${VERBOSE} = "yes" ]] && set -x; go vet ./...;
.PHONY: lint
lint:
@[[ ${VERBOSE} = "yes" ]] && set -x; staticcheck ./...;
.PHONY: tidy
tidy:
@[[ ${VERBOSE} = "yes" ]] && set -x; go mod tidy;
.PHONY: check
check: tidy format vet lint
.PHONY: test
test:
@[[ ${VERBOSE} = "yes" ]] && set -x; go test -race -v ./... -test.count=1 -failfast
.PHONY: compile
compile:
@$(COMPILE); _compile
.DEFAULT_GOAL = help
# Target name % means that it is a rule that matches anything, @: is a recipe;
# the : means do nothing
%:
@: