generated from rog-golang-buddies/golang-template-repository
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
51 lines (42 loc) · 1.01 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
SHELL=/bin/bash -e -o pipefail
PWD = $(shell pwd)
## 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 ./...
## api: Generate Typescript client from OpenAPI spec
.PHONY: api
api:
yarn --cwd ./server/web oazapfts ./src/api/api.yaml ./src/api/api.ts
## web: Build web application
.PHONY: web
web: api
yarn --cwd ./server/web install
yarn --cwd ./server/web build
## build: Build binary into bin/ directory
.PHONY: build
build: web
go build -ldflags="-w -s" -o bin/ ./cmd/...