-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (36 loc) · 1.01 KB
/
Makefile
File metadata and controls
48 lines (36 loc) · 1.01 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
# 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"
@exit 0
.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: bench
bench:
@[[ ${VERBOSE} = "yes" ]] && set -x; go test -test.bench="." -test.run="Benchmark" -benchmem -count=1
.DEFAULT_GOAL = help
# Target name % means that it is a rule that matches anything, @: is a recipe;
# the : means do nothing
%:
@: