forked from janivihervas/contentful-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (84 loc) · 1.66 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
SHELL=/bin/bash
MAKEFLAGS += --no-print-directory --output-sync
GO_FILES_NO_TEST := `find . -name "*.go" -not -name "*_test.go"`
GO_TOOLS := golang.org/x/lint/golint \
golang.org/x/tools/cmd/goimports \
\
github.com/alexkohler/nakedret \
github.com/fzipp/gocyclo \
github.com/kisielk/errcheck \
github.com/mdempsky/unconvert \
\
gitlab.com/opennota/check/cmd/structcheck \
gitlab.com/opennota/check/cmd/varcheck \
\
honnef.co/go/tools/cmd/staticcheck \
.PHONY: all
all: format lint test
.PHONY: install install-new install-update
install:
go mod download
go get -u $(GO_TOOLS)
go mod tidy -v
go mod verify
install-new:
go get ./...
go get -u $(GO_TOOLS)
go mod tidy -v
go mod verify
install-update:
go get -u ./...
go get -u $(GO_TOOLS)
go mod tidy -v
go mod verify
.PHONY: format
format:
gofmt -s -w -e -l .
goimports -w -e -l .
.PHONY: vet golint
vet:
go vet ./...
golint:
golint -set_exit_status ./...
.PHONY: nakedret gocyclo errcheck unconvert
nakedret:
nakedret ./...
gocyclo:
gocyclo -over 13 $(GO_FILES_NO_TEST)
errcheck:
errcheck -ignoretests ./...
unconvert:
unconvert ./...
.PHONY: structcheck varcheck
structcheck:
structcheck ./...
varcheck:
varcheck ./...
.PHONY: staticcheck
staticcheck:
staticcheck ./...
.PHONY: lint
lint:
@$(MAKE) -j \
vet \
golint \
\
nakedret \
gocyclo \
errcheck \
unconvert \
\
structcheck \
varcheck \
\
staticcheck
.PHONY: test
test:
go test -race -cover -run="^Test.*" ./...
.PHONY: test-all
test-all:
go test -race -cover ./...
.PHONY: test-codecov
test-codecov:
go test -race -coverprofile=coverage.out -covermode=atomic ./...
bash <(curl -s https://codecov.io/bash)