-
Notifications
You must be signed in to change notification settings - Fork 132
/
Makefile
48 lines (37 loc) · 1.06 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
#
# SPDX-License-Identifier: Apache-2.0
#
base_dir := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
go_bin_dir := $(shell go env GOPATH)/bin
.PHONY: test
test: lint unit-test
.PHONY: unit-test
unit-test:
cd '$(base_dir)' && \
go test -timeout 30s -race -coverprofile=cover.out ./...
.PHONY: generate
generate:
go install github.com/maxbrunsfeld/counterfeiter/v6@latest
cd '$(base_dir)' && \
go generate ./...
.PHONY: lint
lint: staticcheck golangci-lint
.PHONY: staticcheck
staticcheck:
go install honnef.co/go/tools/cmd/staticcheck@latest
cd '$(base_dir)' && \
staticcheck -f stylish ./...
.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
cd '$(base_dir)' && \
golangci-lint run
.PHONY: scan
scan:
go install golang.org/x/vuln/cmd/govulncheck@latest
cd '$(base_dir)' && \
govulncheck ./...