-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (66 loc) · 1.68 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
# Define Go command and flags
GO = go
GOFLAGS = -ldflags="-s -w"
TARGET = go-api-starter
MAINAPPPATH = ./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 clean
go build $(GOFLAGS) -o bin/${TARGET} ${MAINAPPPATH}
file bin/${TARGET}
.PHONY: docs
## docs - updates the swagger docs
docs:
swag init
.PHONY: build
## build - Builds the project in preparation for debug
build: #clean
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 ./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
golangci-lint run ./... api config handlers middleware models router
.PHONY: watch
## watch - use air server for hot reloading
watch:
air