-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (46 loc) · 1.55 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
# ============================================================================ #
# HELPERS
# ============================================================================ #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
# ============================================================================ #
# DEVELOPMENT
# ============================================================================ #
## run/example: run the example application
.PHONY: run/example
run/example:
go run ./example/main.go
# ============================================================================ #
# QUALITY CONTROL
# ============================================================================ #
## lint: run Go linters (golangci-lint)
.PHONY: lint
lint: ## Runs lint
@echo 'Linting code...'
golangci-lint run
## audit: tidy dependencies and format, vet and test all code
.PHONY: audit
audit: vendor lint
@echo 'Formatting code...'
go fmt
@echo 'Running tests...'
go test -v -race -vet=off
## vendor: tidy and vendor dependencies
.PHONY: vendor
vendor:
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
@echo 'Vendoring dependencies...'
go mod vendor
## test-coverage: test code and check coverage (generates coverage.out)
.PHONY: test-coverage
test-coverage:
go test -v -race -coverprofile=coverage.out -covermode=atomic
## coverage-html: check code coverage and generate HTML report
.PHONY: coverage-html
coverage-html: coverage
go tool cover -html=coverage.out