-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (29 loc) · 1023 Bytes
/
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
# Default flags used by the test, testci, testcover targets
COVERAGE_PATH ?= coverage.out
COVERAGE_ARGS ?= -covermode=atomic -coverprofile=$(COVERAGE_PATH)
TEST_ARGS ?= -race $(COVERAGE_ARGS)
# 3rd party tools
LINT := go run github.com/mgechev/revive@v1.3.4
REFLEX := go run github.com/cespare/reflex@v0.3.1
STATICCHECK := go run honnef.co/go/tools/cmd/staticcheck@2023.1.3
test:
go test $(TEST_ARGS) ./...
.PHONY: test
# Test command to run for continuous integration, which includes code coverage
# based on codecov.io's documentation:
# https://github.com/codecov/example-go/blob/b85638743b972bd0bd2af63421fe513c6f968930/README.md
testci:
go test $(TEST_ARGS) $(COVERAGE_ARGS) ./...
.PHONY: testci
testcover: testci
go tool cover -html=$(COVERAGE_PATH)
.PHONY: testcover
lint:
test -z "$$(gofmt -d -s -e .)" || (echo "Error: gofmt failed"; gofmt -d -s -e . ; exit 1)
go vet ./...
$(LINT) -set_exit_status ./...
$(STATICCHECK) ./...
.PHONY: lint
clean:
rm -rf $(COVERAGE_PATH)
.PHONY: clean