Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (50 loc) · 1.61 KB
/
Copy pathMakefile
File metadata and controls
65 lines (50 loc) · 1.61 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
54
55
56
57
58
59
60
61
62
63
64
65
GO ?= go
GOLANGCI_LINT ?= golangci-lint
# The oldest Go release cli-kit supports; keep it in sync with go.mod.
GO_MIN ?= go1.27.0
.PHONY: all test race cover lint fmt vet cross test-min test-locale fuzz demo tidy-check check
all: check
test:
$(GO) test ./...
race:
$(GO) test -race ./...
cover:
$(GO) test -coverprofile=coverage.out ./...
$(GO) tool cover -func=coverage.out | tail -1
lint:
$(GOLANGCI_LINT) run ./...
fmt:
$(GOLANGCI_LINT) fmt ./...
vet:
$(GO) vet ./...
# Build every package for the platforms the kit supports.
cross:
GOOS=linux $(GO) build ./...
GOOS=darwin $(GO) build ./...
GOOS=windows $(GO) build ./...
GOOS=freebsd $(GO) build ./...
# Run the tests on the oldest supported Go release, so an API added in a
# newer standard library cannot slip in unnoticed.
test-min:
GOTOOLCHAIN=$(GO_MIN) $(GO) test ./...
# Widths must not depend on the locale: run the tests the way a Japanese,
# Chinese or Korean environment would, where go-runewidth counts ambiguous
# characters as wide.
test-locale:
LC_ALL=ja_JP.UTF-8 RUNEWIDTH_EASTASIAN=1 $(GO) test ./...
# Run every fuzz target for FUZZTIME each. Their seed corpora already run
# with the plain tests.
FUZZTIME ?= 30s
fuzz:
@set -e; for pkg in $$($(GO) list ./...); do \
for target in $$($(GO) test -list '^Fuzz' $$pkg | grep '^Fuzz' || true); do \
echo "$$pkg $$target"; \
$(GO) test -run '^$$' -fuzz "^$$target$$" -fuzztime $(FUZZTIME) $$pkg; \
done; \
done
# Try the interactive packages by hand: make demo ARGS=pick
demo:
$(GO) run ./examples/demo $(ARGS)
tidy-check:
$(GO) mod tidy -diff
check: vet lint race test-locale cross tidy-check