-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckfile
More file actions
33 lines (28 loc) · 1.69 KB
/
Copy pathCheckfile
File metadata and controls
33 lines (28 loc) · 1.69 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
# -trimpath and -buildvcs=false keep a test binary a function of its
# source alone. Without them a worker's slot path and the commit stamp
# are built in, so a result cached by one slot never counts for
# another and every run starts cold.
test: go test -trimpath -buildvcs=false -race -cover ./...
# goimports rather than gofmt, as in every other repo here: one command
# to remember, and it still holds if this module ever imports something
# of its own. -l lists what it would rewrite, and a non-empty list is
# the failure, since a CI job that rewrote source would have nowhere to
# put it.
lint: out=$(goimports -local "$(go list -m)" -l .); if [ -n "$out" ]; then echo "$out"; exit 1; fi; go vet ./...
# gopls at hint severity is what an editor underlines and nobody
# reading a diff sees. It exits 0 whether or not it found anything, so
# its output is the verdict: awk prints what it read, then fails if it
# read a line.
hints: git ls-files -z '*.go' | xargs -0 gopls check -severity=hint | awk '1; END { exit (NR > 0) }'
# procman is a binary, not a library, so nothing outside it calls in and
# an unreachable function is dead. deadcode exits 0 whatever it found,
# so awk prints what it read, then fails if it read a line.
deadcode: deadcode -test ./... 2>&1 | awk '1; END { exit (NR > 0) }'
# dprint holds the Markdown to one width, so a doc edit produces a diff
# of what changed and not of where the lines now wrap. Markdown is the
# only language dprint.json loads a plugin for.
fmt: dprint check
# The pre-push hook is the only shell here, and it is the file a clone
# runs on every push, so a quoting bug in it fails a push and not a
# test.
shellcheck: git ls-files -z '*.sh' 'bin/*' | xargs -0 shellcheck