-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Makefile
69 lines (49 loc) · 1.7 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
default: ci
ci: fmt lint cover
ci-full: ci dependencies-analyze openapi-check check-all-modules lint-markdown bench
test:
go test ./... ./examples/petstore/...
cover:
go test -coverprofile=coverage.out ./... ./examples/petstore/...
go tool cover -func=coverage.out
check-all-modules:
./check-all-modules.sh
cover-web: cover
go tool cover -html=coverage.out
bench:
go test -bench ./... -benchmem
build:
go build -v ./... ./examples/petstore/...
dependencies-analyze:
which govulncheck || go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
fmt:
which gofumpt || go install mvdan.cc/gofumpt@latest
gofumpt -l -w -extra .
FIX := "--fix"
lint:
which golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run ${FIX} ./...
lint-markdown:
markdownlint ${FIX} --ignore documentation/node_modules --dot .
# Update golden files
golden-update:
(cd examples/petstore/lib && go test -update)
# Check OpenAPI spec generated for the Petstore example. Uses https://github.com/daveshanley/vacuum
openapi-check:
vacuum lint -d examples/petstore/lib/testdata/doc/openapi.json
# Examples
example:
( cd examples/full-app-gourmet && go run . -debug )
example-watch:
( cd examples/full-app-gourmet && air -- -debug )
petstore:
( cd examples/petstore && go run . -debug )
# Documentation website
docs:
go run golang.org/x/pkgsite/cmd/pkgsite@latest -http localhost:8084
docs-open:
go run golang.org/x/pkgsite/cmd/pkgsite@latest -http localhost:8084 -open
.PHONY: docs-open docs example-watch example lint lint-markdown fmt ci ci-full
.PHONY: dependencies-analyze build bench cover-web cover test petstore check-all-modules
.PHONY: golden-update openapi-check