-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (43 loc) · 1.37 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
GO = GO111MODULE=on go
## display this help message
help:
@echo ''
@echo 'make targets for the project:'
@echo
@echo 'Usage:'
@echo ' ## Develop / Test Commands'
@echo ' all Run all the commands.'
@echo ' clean Run clean up.'
@echo ' setup Run setup of tools needed. This should only be executed once.'
@echo ' fmt Run code formatter.'
@echo ' check Run static code analysis (lint).'
@echo ' test Run tests on project.'
@echo ' deps Run all dependencies that are needed.'
@echo ''
all: clean deps fmt check test
clean:
@echo "==> Cleaning..."
rm -f coverage.out
rm -f report.json
deps:
@echo "==> Getting Dependencies..."
${GO} mod tidy
${GO} mod download
test:
@echo "==> Testing..."
CGO_ENABLED=0 ${GO} test -v -covermode=atomic -count=1 ./... -coverprofile coverage.out
${GO} test -v -race -covermode=atomic -count=1 ./... -json > report.json
${GO} tool cover -func=coverage.out
fmt:
@echo "==> Code Formatting..."
${GO} fmt ./...
check: fmt
@echo "==> Code Check..."
golangci-lint run --fast --tests
clean_cache:
@${GO} clean -cache -modcache -i -r -x
## run this to install the needed tools in this make file (for the lint and check targets).
## You should only need to do this once.
setup:
@echo "==> Setup..."
${GO} get -u github.com/golangci/golangci-lint/cmd/golangci-lint