-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
48 lines (37 loc) · 1.13 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
.PHONY: all test lint vet fmt checkfmt prepare updep
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: build
prepare: fmt test vet checkfmt #m updep
test:
@echo "$(OK_COLOR)Test packages$(NO_COLOR)"
@go test -v ./...
lint:
@echo "$(OK_COLOR)Run lint$(NO_COLOR)"
test -z "$$(golint -min_confidence 0.1 ./... | grep -v Godeps/_workspace/src/ | tee /dev/stderr)"
vet:
@echo "$(OK_COLOR)Run vet$(NO_COLOR)"
@go vet ./...
checkfmt:
@echo "$(OK_COLOR)Check formats$(NO_COLOR)"
@./script/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 github.com/tools/godep
go get golang.org/x/tools/cmd/goimports
go get github.com/golang/lint/golint
updep:
@echo "$(OK_COLOR)Update dependencies$(NO_COLOR)"
GOOS=linux godep save ./...
GOOS=linux godep update github.com/...
GOOS=linux godep update gopkg.in/...
GOOS=linux godep update golang.org/...
build:
@echo "$(OK_COLOR)Building$(NO_COLOR)"
go build