-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (38 loc) · 1.16 KB
/
Makefile
File metadata and controls
53 lines (38 loc) · 1.16 KB
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
# apitpl package Makefile
SHELL = /bin/bash
CFG = .env
GO ?= go
SOURCES ?= *.go */*.go */*/*.go
# ------------------------------------------------------------------------------
.PHONY: help
##
## Available make targets
##
# default: show target list
all: help
# ------------------------------------------------------------------------------
## Sources
## Run linters
lint:
golint ./...
golangci-lint run ./... ./ginapitpl/...
## Run tests and fill coverage.out
cov: coverage.out
# internal target
coverage.out: $(SOURCES)
$(GO) test -race -coverprofile=$@ -covermode=atomic ./...
## Open coverage report in browser
cov-html: cov
$(GO) tool cover -html=coverage.out
## Clean coverage report
cov-clean:
rm -f coverage.*
# ------------------------------------------------------------------------------
## Misc
## Count lines of code (including tests) and update LOC.md
cloc: LOC.md
LOC.md: $(SOURCES)
cloc --by-file --not-match-f='(_mock_test.go|.sql|ml|.md|file|resource.go)$$' --md . > $@
## List Makefile targets
help: Makefile
@grep -A1 "^##" $< | grep -vE '^--$$' | sed -E '/^##/{N;s/^## (.+)\n(.+):(.*)/\t\2:\1/}' | column -t -s ':'