-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
55 lines (46 loc) · 1.24 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
PROJECTNAME=$(shell basename "$(PWD)")
MAKEFLAGS += --silent
all: help
.PHONY: all
## install: Install deps
install:
@echo " Installing deps..."
@go mod download
.PHONY: install
## test: Run tests
test:
@echo " Running tests..."
@go test ./...
.PHONY: test
## test-watch: Run tests in watch mode (rerun on change)
test-watch:
@echo " Running tests in watch mode..."
go test ./...
watchexec -e go -r "go test ./..."
.PHONY: test-watch
## coverage: Run tests with coverage
coverage:
@echo " Running tests with coverage..."
@go test -v -run=Test ./... -coverprofile c.out
.PHONY: coverage
## coverage-watch: Run tests with coverage in watch mode (rerun on change)
coverage-watch:
@echo " Running tests with coverage in watch mode..."
watchexec -e go -r "go test -v -run=Test ./... -coverprofile c.out"
.PHONY: coverage-watch
## coverage-results: Open coverage results
coverage-results:
@go tool cover -html=c.out
.PHONY: coverage-results
## doc: Run godoc in watch mode (rerun on change)
doc:
@echo " Running godoc in watch mode..."
watchexec -e go -r "godoc -http=:8080"
.PHONY: doc
.PHONY: help
help: Makefile
@echo
@echo " Choose a command run in "$(PROJECTNAME)":"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo