forked from hyperledger/fabric-admin-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (50 loc) · 1.52 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
61
62
63
64
65
66
67
base_dir := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
go_dir := $(base_dir)/pkg
node_dir := $(base_dir)/node
go_bin_dir := $(shell go env GOPATH)/bin
.PHONY: unit-test
unit-test: unit-test-go unit-test-node
.PHONY: unit-test-go
unit-test-go:
cd '$(base_dir)' && \
go test -race -coverprofile='$(base_dir)/coverage.out' '$(go_dir)/...'
.PHONY: unit-test-node
unit-test-node:
cd '$(node_dir)/admin' && \
npm install
.PHONY: lint
lint: staticcheck golangci-lint
.PHONY: staticcheck
staticcheck:
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck -f stylish '$(base_dir)/...'
.PHONY: install-golangci-lint
install-golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go_bin_dir)
$(go_bin_dir)/golangci-lint:
$(MAKE) install-golangci-lint
.PHONY: golangci-lint
golangci-lint: $(go_bin_dir)/golangci-lint
golangci-lint run
.PHONY: scan
scan: scan-go scan-node
.PHONY: scan-go
scan-go: scan-go-govulncheck
.PHONY: scan-go-govulncheck
scan-go-govulncheck:
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck '$(base_dir)/...'
.PHONY: scan-node
scan-node: scan-node-npm-audit
.PHONY: scan-node-npm-audit
scan-node-npm-audit:
cd "$(node_dir)/admin" && \
npm install --package-lock-only && \
npm audit --omit=dev
.PHONY: escapes_detect
escapes_detect:
@go build -gcflags="-m -l" ./... 2>&1 | grep "escapes to heap" || true
.PHONY: generate
generate:
go install go.uber.org/mock/mockgen@latest
go generate ./pkg/...