-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (46 loc) · 1.03 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
.PHONY: cli
cli:
rm -f tutil
go build -o ./tutil ./cmd/tutil
.PHONY: testenv
testenv:
( cd testenv ; make testenv )
.PHONY: stop-testenv
stop-testenv:
( cd testenv ; make clean )
.PHONY: test
test: vendor
go test -race -cover ./...
.PHONY: lint
lint: vendor
golint $(go list ./... | grep -v /vendor/)
# cleanup dependencies and download missing ones
.PHONY: deps
deps:
go mod tidy
go mod download
# run dependency cleanup, followed by updating the patch version
.PHONY: deps-update
deps-update: deps
go get -u=patch
# run tests
.PHONY: tests
tests:
go test -race -cover -count 1 ./...
# run standard go tooling for better rcode hygiene
.PHONY: tidy
tidy: imports fmt
go vet ./...
golint ./...
# automatically add missing imports
.PHONY: imports
imports:
find . -type f -name '*.go' -exec goimports -w {} \;
# format code and simplify if possible
.PHONY: fmt
fmt:
find . -type f -name '*.go' -exec gofmt -s -w {} \;
verifiers: staticcheck
staticcheck:
@echo "Running $@ check"
@GO111MODULE=on ${GOPATH}/bin/staticcheck ./...