-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
64 lines (52 loc) · 1.47 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
.PHONY: default setup lint format add-license-headers vet check compile test test-fast update-dependencies
default: test
setup:
@echo "Installing build tools..."
@go install github.com/google/[email protected]
@go install gotest.tools/[email protected]
@go install go.uber.org/mock/[email protected]
lint: setup
ifeq ($(OS),Windows_NT)
@.\tools\check-format.cmd
else
@go install github.com/google/addlicense@v1
@sh ./tools/check-format.sh
@sh ./tools/check-license-headers.sh
@go mod tidy
endif
format:
@gofmt -w .
add-license-headers:
ifeq ($(OS),Windows_NT)
@echo "This is currently not supported on windows"
@exit 1
else
@sh ./tools/add-missing-license-headers.sh
endif
vet: generate-mocks
@echo "Vetting files"
@go vet -tags '!unit' ./...
check:
@echo "Static code analysis"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1
@golangci-lint run ./...
.PHONY: generate-mocks
generate-mocks:
@echo "Generating mocks"
@go install go.uber.org/mock/[email protected]
@go generate ./...
compile: generate-mocks
@echo "Compiling sources..."
@go build ./...
@echo "Compiling tests..."
@go test -run "NON_EXISTENT_TEST_TO_ENSURE_NOTHING_RUNS_BUT_ALL_COMPILE" ./...
test: setup generate-mocks
@echo "Testing $(BINARY_NAME)..."
@gotestsum ${testopts} -- -v -race ./...
test-fast: setup
@echo "Testing short tests $(BINARY_NAME)..."
@gotestsum ${testopts} -- -v -race -short ./...
update-dependencies:
@echo Update go dependencies
@go get -u ./...
@go mod tidy