-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
78 lines (65 loc) · 1.89 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
all: gen test install
help:
@echo "\tdeps: installs all dependencies"
@echo "\tgen: generates boilerplate code"
@echo "\ttest: Run all tests"
deps:
@echo "---------------------------"
@echo "Performing dependency check"
@echo "---------------------------"
go get -u golang.org/x/tools/cmd/goimports
go get -u -t ./... # get the application with all its deps
generate:
@echo "----------------------"
@echo "Generating source-code"
@echo "----------------------"
go generate ./...
imports:
@echo "------------------"
@echo "Optimizing imports"
@echo "------------------"
find . -name '*.go' -exec goimports -l -w -local github.com/ {} \;
format: imports
@echo "----------------------"
@echo "Formatting source-code"
@echo "----------------------"
find . -name '*.go' -exec gofmt -l -s -w {} \;
gen: generate imports format
check:
@echo "---------------------"
@echo "Perform static analysis"
@echo "---------------------"
go vet ./...
test: check
@echo "---------------------"
@echo "Running backend tests"
@echo "---------------------"
go test ./... # run unit tests
make format
citest:
@echo "---------------------"
@echo "Running backend tests"
@echo "---------------------"
go get -u golang.org/x/tools/cmd/goimports
go generate -tags ci ./...
make imports
go test -tags ci ./... # run unit tests
make format
coverage:
@echo "----------------"
@echo "Running coverage"
@echo "----------------"
./scripts/coverage.sh --html
install:
@echo "----------------------------"
@echo "Installing"
@echo "----------------------------"
go install ./...
.PHONY:
help deps gen check test citest coverage install all
#release:
# @echo "---------------------"
# @echo "Building release binary"
# @echo "---------------------"
# mkdir -p release
# CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s -w' -o release/