-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (46 loc) · 1.15 KB
/
Makefile
File metadata and controls
63 lines (46 loc) · 1.15 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
61
62
63
GOCACHE ?= /tmp/go-build
STATICCHECK_CACHE ?= /tmp/staticcheck
export GOCACHE
export STATICCHECK_CACHE
.PHONY: fmt fmt_check vet staticcheck security lint check build test test_v test_race test_cov coverage coverage_html clean_cov
build:
go build ./...
test:
go test ./...
test_v:
go test -v ./...
test_race:
go test -race ./...
test_cov:
go test ./... -coverprofile=cover.out -cover
go tool cover -func=cover.out
coverage: test_cov coverage_html
coverage_html:
go tool cover -html=cover.out -o coverage.html
fmt:
gofmt -w .
fmt_check:
@test -z "$$(gofmt -l .)" || (gofmt -l . && exit 1)
vet:
go vet ./...
staticcheck:
@if command -v staticcheck >/dev/null 2>&1; then \
staticcheck ./...; \
else \
echo "staticcheck not installed; skipping"; \
fi
security:
@if command -v govulncheck >/dev/null 2>&1; then \
govulncheck ./...; \
else \
echo "govulncheck not installed; skipping"; \
fi
@if command -v gosec >/dev/null 2>&1; then \
gosec ./...; \
else \
echo "gosec not installed; skipping"; \
fi
lint: fmt_check vet staticcheck
check: lint security build test_race test_cov coverage_html
clean_cov:
rm -f cover.out coverage.html