-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
93 lines (67 loc) · 1.7 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
83
84
85
86
87
88
89
90
91
92
93
# Define Go command and flags
GO = go
GOFLAGS = -ldflags="-s -w"
TARGET = gogoodwe
MAINAPPPATH = ./cmd/gogoodwe/main.go
default: help
.PHONY: help
## help - Display help about make targets for this Makefile
help:
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t
.PHONY: release
## release - Builds the project in preparation for (local)release
release: vet lint seccheck
go generate ${MAINAPPPATH}
go build $(GOFLAGS) -o bin/${TARGET} ${MAINAPPPATH}
file bin/${TARGET}
.PHONY: goreleaser
## goreleaser - Builds the project in preparation for release
goreleaser:
goreleaser release --snapshot --clean
.PHONY: docs
## docs - updates the swagger docs
docs:
swag init
.PHONY: build
## build - Builds the project in preparation for debug
build:
go build -o bin/${TARGET} ${MAINAPPPATH}
file bin/${TARGET}
.PHONY: run
## run - builds and runs the program on the target platform
run:
go run ${MAINAPPPATH}
.PHONY: clean
## clean - Remove the old builds and any debug information
clean:
go clean -cache
go clean
rm -rf dist
rm bin/${TARGET}
.PHONY: test
## test - executes unit tests
test:
go test -v ./test/...
.PHONY: deps
## deps - fetches any external dependencies and updates
deps:
go mod tidy
go mod download
go get -u ./...
.PHONY: vet
## vet - Vet examines Go source code and reports suspicious constructs
vet:
go vet ./...
.PHONY: staticcheck
## staticcheck - Runs static code analyzer staticcheck - currently broken
staticcheck:
staticcheck ./...
.PHONY: seccheck
## seccheck - Code vulnerability check
seccheck:
govulncheck ./...
.PHONY: lint
## lint - format code and tidy modules
lint:
go fmt ./...
go mod tidy -v