-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
59 lines (46 loc) · 1.67 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
.PHONY: deps test mocks lint format check-license add-license \
shorten-lines salus check-format
GO_PACKAGES=./services/... ./client/... ./configuration/... ./utils/... ./examples/... ./contracts/... ./types/...
TEST_SCRIPT=go test ${GO_PACKAGES}
LINT_CONFIG=.golangci.yml
GOIMPORTS_INSTALL=go install golang.org/x/tools/cmd/goimports@latest
GOIMPORTS_CMD=goimports
LINT_SETTINGS=golint,misspell,gocyclo,gocritic,whitespace,goconst,gocognit,bodyclose,unconvert,lll,unparam
ADDLICENSE_INSTALL=go install github.com/google/addlicense@latest
ADDLICENSE_CMD=addlicense
ADDLICENSE_IGNORE=-ignore ".github/**/*" -ignore ".idea/**/*" -ignore .codeflow.yml -ignore "examples/ethereum/*/*/*"
ADDLICENCE_SCRIPT=${ADDLICENSE_CMD} -c "Coinbase, Inc." -l "apache" -v ${ADDLICENSE_IGNORE}
GOLINES_INSTALL=go install github.com/segmentio/golines@latest
GOLINES_CMD=golines
deps:
go get ./...
build:
go build ${GO_PACKAGES}
test:
${TEST_SCRIPT}
mocks:
rm -rf mocks;
mockery --dir services --all --case underscore --outpkg services --output mocks/services;
mockery --dir client --all --case underscore --outpkg client --output mocks/client;
lint:
golangci-lint run --timeout 2m0s -v -E ${LINT_SETTINGS},gomnd
format:
gofmt -s -w -l .
fix-imports:
${GOIMPORTS_INSTALL}
${GOIMPORTS_CMD} -w .
add-license:
${ADDLICENSE_INSTALL}
${ADDLICENCE_SCRIPT} .
check-license:
${ADDLICENSE_INSTALL}
${ADDLICENCE_SCRIPT} -check .
shorten-lines:
${GOLINES_INSTALL}
${GOLINES_CMD} -w --shorten-comments configuration client examples services types utils
salus:
docker run --rm -t -v ${PWD}:/home/repo coinbase/salus
check-format:
! gofmt -s -l . | read;
${GOIMPORTS_INSTALL}
! ${GOIMPORTS_CMD} -l . | read;