generated from rog-golang-buddies/golang-template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (35 loc) · 843 Bytes
/
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
SHELL=/bin/bash -e -o pipefail
PWD = $(shell pwd)
GO_BUILD= go build
GOFLAGS= CGO_ENABLED=0
## help: Print this help message
.PHONY: help
help:
@echo "Usage:"
@sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /'
## test: Run tests
.PHONY: test
test:
go test -race -v ./...
## cover: Run tests and show coverage result
.PHONY: cover
cover:
go test -v -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
## tidy: Cleanup and download missing dependencies
.PHONY: tidy
tidy:
go mod tidy
go mod verify
## vet: Examine Go source code and reports suspicious constructs
.PHONY: vet
vet:
go vet ./...
## fmt: Format all go source files
.PHONY: fmt
fmt:
go fmt ./...
## build: Build binary into bin/ directory
.PHONY: build
build:
$(GOFLAGS) $(GO_BUILD) -a -v -ldflags="-w -s" -o bin/app cmd/main.go