-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (41 loc) · 1.25 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
.PHONY: all test test_v test_i lint vet fmt coverage checkfmt prepare errcheck race
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
PKGSDIRS=$(shell find -L . -type f -name "*.go" -not -path "./Godeps/*")
all: prepare
travis: checkfmt vet lint errcheck test_v test_i
prepare: fmt vet lint checkfmt errcheck test race
test_v:
@echo "$(OK_COLOR)Test packages$(NO_COLOR)"
@go test -cover -v ./...
test:
@echo "$(OK_COLOR)Test packages$(NO_COLOR)"
@go test -cover ./...
test_i:
@echo "$(OK_COLOR)Run integration tests$(NO_COLOR)"
@go test -cover -tags integration -run TestI_* ./...
lint:
@echo "$(OK_COLOR)Run lint$(NO_COLOR)"
@test -z "$$(golint -min_confidence 0.3 ./... )"
vet:
@echo "$(OK_COLOR)Run vet$(NO_COLOR)"
@go vet ./...
errcheck:
@echo "$(OK_COLOR)Run errchk$(NO_COLOR)"
@errcheck
race:
@echo "$(OK_COLOR)Test for races$(NO_COLOR)"
@go test -race .
checkfmt:
@echo "$(OK_COLOR)Check formats$(NO_COLOR)"
@./scripts/checkfmt.sh .
fmt:
@echo "$(OK_COLOR)Formatting$(NO_COLOR)"
@echo $(PKGSDIRS) | xargs -I '{p}' -n1 goimports -w {p}
tools:
@echo "$(OK_COLOR)Install tools$(NO_COLOR)"
go get golang.org/x/tools/cmd/goimports
go get github.com/golang/lint/golint
go get github.com/kisielk/errcheck