...
1GOFMT:=gofumpt
2STATICCHECK=staticcheck
3TEST?=$$(go list ./... |grep -v 'vendor')
4
5default: build
6
7ifdef TEST_FILTER
8 TEST_FILTER := -run $(TEST_FILTER)
9endif
10
11build: fmtcheck
12 go install
13
14clean:
15 go clean -cache -testcache ./...
16
17clean-all:
18 go clean -cache -testcache -modcache ./...
19
20dep:
21 go mod tidy
22
23fmt: tools
24 @$(GOFMT) -l -w .
25
26fmtcheck:
27 @gofumpt -d -l .
28
29test:
30 echo $(TEST) | \
31 xargs -t -n4 go test -test.v $(TESTARGS) $(TEST_FILTER) -timeout=30s -parallel=4
32
33tools:
34 @which $(GOFMT) || go install mvdan.cc/gofumpt@v0.2.1
35 @which $(STATICCHECK) || go install honnef.co/go/tools/cmd/staticcheck@2021.1.2
36
37tools-update:
38 @go install mvdan.cc/gofumpt@v0.2.1
39 @go install honnef.co/go/tools/cmd/staticcheck@2021.1.2
40
41vet:
42 @go vet ./...
43 @staticcheck ./...
View as plain text