-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
82 lines (66 loc) · 1.92 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
dev_build_version=$(shell git describe --tags --always --dirty)
.PHONY: ci
ci: deps checkgofmt vet predeclared staticcheck ineffassign errcheck golint golint test
.PHONY: deps
deps:
go get -d -v -t ./...
.PHONY: updatedeps
updatedeps:
go get -d -v -t -u -f ./...
.PHONY: install
install:
go install -ldflags '-X "github.com/jhump/goprotoc/app/goprotoc.version=dev build $(dev_build_version)"' ./...
.PHONY: release
release:
@GO111MODULE=on go install github.com/goreleaser/goreleaserv0.134.0
goreleaser --rm-dist
.PHONY: checkgofmt
checkgofmt:
@echo gofmt -s -l .
@if [ -n "$$(go version | awk '{ print $$3 }' | grep -v devel)" ]; then \
output="$$(gofmt -s -l .)" ; \
if [ -n "$$output" ]; then \
echo "$$output"; \
echo "Run gofmt on the above files!"; \
exit 1; \
fi; \
fi
.PHONY: vet
vet:
go vet ./...
.PHONY: staticcheck
staticcheck:
@GO111MODULE=on go install honnef.co/go/tools/cmd/[email protected]
staticcheck ./...
.PHONY: ineffassign
ineffassign:
@GO111MODULE=on go install github.com/gordonklaus/[email protected]
ineffassign .
.PHONY: predeclared
predeclared:
@GO111MODULE=on go install github.com/nishanths/[email protected]
predeclared ./...
.PHONY: golint
golint:
@GO111MODULE=on go install golang.org/x/lint/[email protected]
golint -min_confidence 0.9 -set_exit_status ./...
.PHONY: errcheck
errcheck:
@GO111MODULE=on 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