-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (38 loc) · 1.29 KB
/
Makefile
File metadata and controls
52 lines (38 loc) · 1.29 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
# Based on the Example from Joel Homes, author of "Shipping Go" at
# https://github.com/holmes89/hello-api/blob/main/ch10/Makefile
# https://stackoverflow.com/a/54776239
SHELL := /bin/bash
GO_VERSION := 1.25 # <1>
COVERAGE_AMT := 70 # should be 80
HEREGOPATH := $(shell go env GOPATH)
CURDIR := $(shell pwd)
test:
go test -v -coverpkg=./... -coverprofile=coverage.out ./...
coverage-verbose:
go tool cover -func coverage.out | tee cover.rpt
coverage-ok:
cat cover.rpt | grep "total:" | awk '{print ((int($$3) > ${COVERAGE_AMT}) != 1) }'
cover-report:
go tool cover -html=coverage.out -o cover.html
clean:
rm $$(find . -name "*cover*html" -or -name "*cover.rpt" -or -name "*coverage.out")
check: check-format check-vet test coverage-verbose coverage-ok cover-report lint
check-format:
test -z $$(go fmt ./...)
check-vet:
test -z $$(go vet ./...)
testme:
echo $(HEREGOPATH)
install-lint:
# https://golangci-lint.run/usage/install/#local-installation to GOPATH
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(HEREGOPATH)/bin v1.57.2
# report version
${HEREGOPATH}/bin/golangci-lint --version
lint:
# golangci-lint run -v ./...
${HEREGOPATH}/bin/golangci-lint run ./...
module-update-tidy:
go get -u ./...
go mod tidy
build:
go build .