forked from urfave/sflags
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (46 loc) · 1.78 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
.PHONY: all test test_v generate lint vet fmt coverage check check-fast prepare 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")
all: prepare
travis: info vet lint check test_v coverage
coverage:
@echo "$(OK_COLOR)Generate coverage$(NO_COLOR)"
@./scripts/cover_multi.sh
prepare: generate fmt vet lint check 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 ./...
lint:
@echo "$(OK_COLOR)Run lint$(NO_COLOR)"
@test -z "$$(golint -min_confidence 0.3 ./... | tee /dev/stderr)"
check:
@echo "$(OK_COLOR)Run golangci-lint$(NO_COLOR)"
@golangci-lint run --no-config --exclude-use-default=true --max-same-issues=10 --disable=gosimple --disable=golint --enable=megacheck --enable=interfacer --enable=goconst --enable=misspell --enable=unparam --enable=goimports --disable=errcheck --disable=ineffassign --disable=gocyclo --disable=gas
vet:
@echo "$(OK_COLOR)Run vet$(NO_COLOR)"
@go vet ./...
race:
@echo "$(OK_COLOR)Test for races$(NO_COLOR)"
@go test -race .
fmt:
@echo "$(OK_COLOR)Formatting$(NO_COLOR)"
@echo $(PKGSDIRS) | xargs -I '{p}' -n1 goimports -w {p}
info:
depscheck -totalonly -tests .
golocc --no-vendor ./...
generate:
@echo "$(OK_COLOR)Go generate$(NO_COLOR)"
@go generate
tools:
@echo "$(OK_COLOR)Install tools$(NO_COLOR)"
go get -u github.com/warmans/golocc
go get -u github.com/divan/depscheck
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
cd ${GOPATH}/src/github.com/golangci/golangci-lint/cmd/golangci-lint
go install -ldflags "-X 'main.version=$(git describe --tags)' -X 'main.commit=$(git rev-parse --short HEAD)' -X 'main.date=$(date)'"