-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (55 loc) · 1.64 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
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo "Usage:"
@sed -n "s/^##//p" ${MAKEFILE_LIST} | column -t -s ":" | sed -e "s/^/ /"
.PHONY: confirm
confirm:
@echo "Are you sure? (y/n) \c"
@read answer; \
if [ "$$answer" != "y" ]; then \
echo "Aborting."; \
exit 1; \
fi
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
## audit: run quality control checks
.PHONY: audit
audit:
@echo "Checking module dependencies"
go mod tidy -diff
go mod verify
@echo "Vetting code..."
test -z "$(shell gofmt -l .)"
go vet ./...
go tool staticcheck -checks=all,-ST1000,-U1000 ./...
go tool govulncheck ./...
@echo "Running tests..."
go test -v -race -vet=off ./...
## test: run all tests
.PHONY: test
test:
go test -v -race -buildvcs ./...
# ==================================================================================== #
# DEVELOPMENT
# ==================================================================================== #
## tidy: tidy and format all .go files
.PHONY: tidy
tidy:
@echo "Tidying module dependencies..."
go mod tidy
@echo "Formatting .go files..."
go fmt ./...
## build/edo: build the cmd/edo application
.PHONY: build/edo
build/edo:
@go build -v -o=./edo .
## run/edo: run the cmd/edo application
.PHONY: run/edo
run/edo: build/edo
@./edo
# vim: set tabstop=4 shiftwidth=4 noexpandtab