-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
82 lines (70 loc) · 2.97 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
.DEFAULT_GOAL := help
.PHONY: teller build test lint check cover install-linters format cover help
PACKAGES = $(shell find ./src -type d -not -path '\./src')
COMMIT=$$(git rev-parse HEAD)
GOLDFLAGS="-X main.gitCommit=$(COMMIT)"
teller: ## Run teller. To add arguments, do 'make ARGS="--foo" teller'.
go run -ldflags $(GOLDFLAGS) cmd/teller/teller.go ${ARGS}
build: ## Build teller binary
go build -ldflags $(GOLDFLAGS) cmd/teller/teller.go
test: ## Run tests
go test ./cmd/... -timeout=1m -cover ${PARALLEL}
go test ./src/addrs/... -timeout=30s -cover ${PARALLEL}
go test ./src/config/... -timeout=30s -cover ${PARALLEL}
go test ./src/exchange/... -timeout=4m -cover ${PARALLEL}
go test ./src/monitor/... -timeout=30s -cover ${PARALLEL}
go test ./src/scanner/... -timeout=4m -cover ${PARALLEL} ${MIN_SHUTDOWN_WAIT}
go test ./src/sender/... -timeout=1m -cover ${PARALLEL}
go test ./src/teller/... -timeout=30s -cover ${PARALLEL}
go test ./src/util/... -timeout=30s -cover ${PARALLEL}
test-race: ## Run tests with -race. Note: expected to fail, but look for "DATA RACE" failures specifically
go test ./cmd/... -timeout=1m -race ${PARALLEL}
go test ./src/addrs/... -timeout=30s -race ${PARALLEL}
go test ./src/config/... -timeout=30s -race ${PARALLEL}
go test ./src/exchange/... -timeout=4m -race ${PARALLEL}
go test ./src/monitor/... -timeout=30s -race ${PARALLEL}
go test ./src/scanner/... -timeout=4m -race ${PARALLEL} ${MIN_SHUTDOWN_WAIT}
go test ./src/sender/... -timeout=1m -race ${PARALLEL}
go test ./src/teller/... -timeout=30s -race ${PARALLEL}
go test ./src/util/... -timeout=30s -race ${PARALLEL}
lint: ## Run linters. Use make install-linters first.
vendorcheck ./...
gometalinter --deadline=3m -j 2 --disable-all --tests --vendor \
-E deadcode \
-E errcheck \
-E gas \
-E goconst \
-E gofmt \
-E goimports \
-E golint \
-E ineffassign \
-E interfacer \
-E maligned \
-E megacheck \
-E misspell \
-E nakedret \
-E structcheck \
-E unconvert \
-E unparam \
-E varcheck \
-E vet \
./...
check: lint test ## Run tests and linters
cover: ## Runs tests on ./src/ with HTML code coverage
go test -cover -coverprofile=cover.out -coverpkg=github.com/skycoin/teller/... ./src/...
go tool cover -html=cover.out
install-linters: ## Install linters
go get -u github.com/FiloSottile/vendorcheck
go get -u github.com/alecthomas/gometalinter
gometalinter --vendored-linters --install
format: # Formats the code. Must have goimports installed (use make install-linters).
# This sorts imports by [stdlib, 3rdpart, skycoin/skycoin, skycoin/teller]
goimports -w -local github.com/skycoin/teller ./cmd
goimports -w -local github.com/skycoin/teller ./src
goimports -w -local github.com/skycoin/skycoin ./cmd
goimports -w -local github.com/skycoin/skycoin ./src
# This performs code simplifications
gofmt -s -w ./cmd
gofmt -s -w ./src
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'