-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (45 loc) · 1.65 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
.PHONY: plandb
plandb:
@go build -o plandb cmd/main/main.go
.PHONY: tester
tester:
@go build -o tester cmd/tester/main.go
.PHONY: config
config:
$(info [go tidy])
@go mod tidy
############# code clean
.PHONY: fmt
fmt:
gofmt -l -s -w .
.PHONY: install-static-check-tools
install-static-check-tools:
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $(GOPATH)/bin v1.61.0
@go install github.com/matrixorigin/linter/cmd/molint@latest
@go install github.com/apache/skywalking-eyes/cmd/[email protected]
.PHONY: static-check
static-check: config err-check
#$(CGO_OPTS) go vet -vettool=`which molint` ./...
$(CGO_OPTS) license-eye -c .licenserc.yml header check
$(CGO_OPTS) license-eye -c .licenserc.yml dep check
$(CGO_OPTS) golangci-lint run -c .golangci.yml ./...
fmtErrs := $(shell grep -onr 'fmt.Errorf' pkg/ --exclude-dir=.git --exclude-dir=vendor \
--exclude=*.pb.go --exclude=system_vars.go --exclude=Makefile)
errNews := $(shell grep -onr 'errors.New' pkg/ --exclude-dir=.git --exclude-dir=vendor \
--exclude=*.pb.go --exclude=system_vars.go --exclude=Makefile)
.PHONY: err-check
err-check:
#ifneq ("$(strip $(fmtErrs))$(strip $(errNews))", "")
# ifneq ("$(strip $(fmtErrs))", "")
# $(warning 'fmt.Errorf()' is found.)
# $(warning One of 'fmt.Errorf()' is called at: $(shell printf "%s\n" $(fmtErrs) | head -1))
# endif
# ifneq ("$(strip $(errNews))", "")
# $(warning 'errors.New()' is found.)
# $(warning One of 'errors.New()' is called at: $(shell printf "%s\n" $(errNews) | head -1))
# endif
#
# $(error Use xxxerr instead.)
#else
# $(info Neither 'fmt.Errorf()' nor 'errors.New()' is found)
#endif