-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
68 lines (55 loc) · 1.33 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
.PHONY: ci
ci: deps checkgofmt errcheck golint vet ineffassign staticcheck test
.PHONY: deps
deps:
go get -d -v -t ./...
.PHONY: updatedeps
updatedeps:
go get -d -v -t -u -f ./...
.PHONY: install
install:
go install ./...
.PHONY: checkgofmt
checkgofmt:
@echo gofmt -s -l .
@output="$$(gofmt -s -l .)" ; \
if [ -n "$$output" ]; then \
echo "$$output"; \
echo "Run gofmt on the above files!"; \
exit 1; \
fi
.PHONY: vet
vet:
go vet ./...
.PHONY: staticcheck
staticcheck:
@go install honnef.co/go/tools/cmd/[email protected]
staticcheck ./...
.PHONY: ineffassign
ineffassign:
@go install github.com/gordonklaus/[email protected]
ineffassign .
.PHONY: golint
golint:
@go install golang.org/x/lint/[email protected]
golint -min_confidence 0.9 -set_exit_status ./...
.PHONY: errcheck
errcheck:
@go install github.com/kisielk/[email protected]
errcheck ./...
.PHONY: test
test:
go test -cover -race ./...
.PHONY: generate
generate:
go generate ./...
.PHONY: testcover
testcover:
@echo go test -race -covermode=atomic ./...
@echo "mode: atomic" > coverage.out
@for dir in $$(go list ./...); do \
go test -race -coverprofile profile.out -covermode=atomic $$dir ; \
if [ -f profile.out ]; then \
tail -n +2 profile.out >> coverage.out && rm profile.out ; \
fi \
done