-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile
50 lines (40 loc) · 1.02 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
.PHONY: install clean build release dry-release cov fmt help vet test
## install: installs dependencies
install:
go mod download
go mod tidy
## clean: cleans the binary
clean:
@echo "Cleaning..."
go clean
## build: build binary
build:
chmod u+x ./scripts/build
./scripts/build
## release: build and upload binaries to Github Releases
release:
goreleaser
## dry-release: build and test goreleaser
dry-release:
goreleaser --snapshot --skip-publish --rm-dist
## help: prints this help message
help:
@echo "Usage: \n"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## fmt: Go Format
fmt:
@echo "Gofmt..."
@if [ -n "$(gofmt -l .)" ]; then echo "Go code is not formatted"; exit 1; fi
## vet: code analysis
vet:
@echo "Vet..."
@go vet ./...
## test: runs go unit test with default values
test: clean install
@echo "Testing..."
go test -v -count=1 -race ./...
## cov: generates coverage report
cov:
@echo "Coverage..."
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out