| 1 |
# ==================================================================================== # |
| 2 |
# HELPERS |
| 3 |
# ==================================================================================== # |
| 4 |
|
| 5 |
## help: print this help message |
| 6 |
.PHONY: help |
| 7 |
help: |
| 8 |
@echo 'Usage:' |
| 9 |
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' |
| 10 |
|
| 11 |
# ==================================================================================== # |
| 12 |
# QUALITY CONTROL |
| 13 |
# ==================================================================================== # |
| 14 |
|
| 15 |
## test: run all tests |
| 16 |
.PHONY: test |
| 17 |
test: |
| 18 |
@echo 'Removing test cache...' |
| 19 |
go clean -testcache |
| 20 |
@echo 'Running tests...' |
| 21 |
go test -race -vet=off -timeout 15s ./... |
| 22 |
|
| 23 |
## bench: run all benchmarks |
| 24 |
.PHONY: bench |
| 25 |
bench: |
| 26 |
@echo 'Running benchmarks...' |
| 27 |
go test -bench=. |
| 28 |
|
| 29 |
## audit: tidy and vendor dependencies and format, vet and test all code |
| 30 |
.PHONY: audit |
| 31 |
audit: tidy |
| 32 |
@echo 'Formatting code...' |
| 33 |
go fmt ./... |
| 34 |
@echo 'Linting code...' |
| 35 |
golangci-lint run |
| 36 |
@echo 'Running tests...' |
| 37 |
go test -race -vet=off ./... |
| 38 |
|
| 39 |
## tidy: tidy and verify dependencies |
| 40 |
.PHONY: tidy |
| 41 |
vendor: |
| 42 |
@echo 'Tidying and verifying module dependencies...' |
| 43 |
go mod tidy |
| 44 |
go mod verify |