forked from m3db/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (64 loc) · 1.34 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
SRCS := $(shell find . -name '*.go')
LINTERS := \
github.com/golang/lint/golint \
github.com/kisielk/errcheck \
honnef.co/go/tools/cmd/staticcheck \
honnef.co/go/tools/cmd/unused
.PHONY: all
all: test
.PHONY: deps
deps:
go get -d -v ./...
.PHONY: updatedeps
updatedeps:
go get -d -v -u -f ./...
.PHONY: testdeps
testdeps:
go get -d -v -t ./...
go get -v $(LINTERS)
.PHONY: updatetestdeps
updatetestdeps:
go get -d -v -t -u -f ./...
go get -u -v $(LINTERS)
.PHONY: install
install: deps
go install ./...
.PHONY: license
license: install
update-license $(SRCS)
.PHONY: golint
golint: testdeps
for file in $(SRCS); do \
golint $${file}; \
if [ -n "$$(golint $${file})" ]; then \
exit 1; \
fi; \
done
.PHONY: vet
vet: testdeps
go vet ./...
.PHONY: testdeps
errcheck: testdeps
errcheck ./...
.PHONY: staticcheck
staticcheck: testdeps
staticcheck ./...
.PHONY: unused
unused: testdeps
unused ./...
.PHONY: checklicense
checklicense: install
@echo update-license --dry $(SRCS)
@if [ -n "$$(update-license --dry $(SRCS))" ]; then \
echo "These files need to have their license updated by running make license:"; \
update-license --dry $(SRCS); \
exit 1; \
fi
.PHONY: lint
lint: golint vet errcheck staticcheck unused checklicense
.PHONY: test
test: testdeps lint
go test -race ./...
.PHONY: clean
clean:
go clean -i ./...