-
Notifications
You must be signed in to change notification settings - Fork 42
/
Makefile
41 lines (31 loc) · 1.17 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
default: build
build: vendor
@echo "✓ Building source code with go build ..."
@go build -mod vendor -v
fmt:
@echo "✓ Formatting source code with goimports ..."
@go run golang.org/x/tools/cmd/goimports@latest -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
@echo "✓ Formatting source code with gofmt ..."
@gofmt -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
lint: vendor
@echo "✓ Linting source code with https://staticcheck.io/ ..."
@go run honnef.co/go/tools/cmd/[email protected] ./...
test: lint
@echo "✓ Running tests ..."
@go run gotest.tools/gotestsum@latest --format pkgname-and-test-fails \
--no-summary=skipped --raw-command go test -v \
-json -short -coverprofile=coverage.txt ./...
coverage: test
@echo "✓ Opening coverage for unit tests ..."
@go tool cover -html=coverage.txt
vendor:
@echo "✓ Filling vendor folder with library code ..."
@go mod vendor
doc:
@echo "Open http://localhost:6060"
@go run golang.org/x/tools/cmd/godoc@latest -http=localhost:6060
install-codegen: vendor
@go build -o ~/go/bin/oac openapi/gen/main.go
gen:
@go run openapi/gen/main.go
.PHONY: fmt vendor fmt coverage test lint doc