Format Go with gofmt, then golines -m 77 (closes #215)
check / check (push) Waiting to run

script/fmt now runs golines -m 77 after gofmt, repeating golines until
it changes nothing, since one pass can leave a line the next splits.
script/fmt-check fails when either would change a file.
script/bootstrap installs golines v0.13.0 with go install, pinned to
its commit, and checks the installed version with go version -m.

The tree is reformatted. The longer lines this makes are fixed by
hand: nolint directives moved onto their own line above the statement,
one string split, and 20 functions over funlen's 80 lines shortened or
split, RunWAF and limitPercentages among them.

Model: opus-5-5
This commit was merged in pull request #363.
This commit is contained in:
clawbot committed 2026-11-11 17:29:12 +01:00
1 parent 63e58e326b
commit 0b23352767
118 files changed
+9447 -2670

No files matched your search

+20 -1
View File
@@ -1,6 +1,6 @@
#!/bin/sh
# script/fmt-check: check formatting (read-only): the Go code with
# gofmt, the Markdown with prettier.
# gofmt and golines -m 77, the Markdown with prettier.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
@@ -24,14 +24,33 @@ run_yarn() {
shift && exec yarn "$@"' bash "$NODE_VERSION" "$@"
}
# The golines that script/bootstrap installed: go install puts it in
# GOBIN, or in GOPATH/bin when GOBIN is unset.
golines_path() {
gobin="$(go env GOBIN)"
golines="${gobin:-$(go env GOPATH)/bin}/golines"
if [ ! -x "$golines" ]; then
echo "fmt-check: no golines; run script/bootstrap first" >&2
exit 1
fi
echo "$golines"
}
main() {
cd "$ROOT"
golines="$(golines_path)"
unformatted="$(gofmt -l cmd internal)"
if [ -n "$unformatted" ]; then
echo "fmt-check: gofmt would change:" >&2
echo "$unformatted" >&2
exit 1
fi
unformatted="$("$golines" -m 77 -l cmd internal)"
if [ -n "$unformatted" ]; then
echo "fmt-check: golines -m 77 would change:" >&2
echo "$unformatted" >&2
exit 1
fi
run_yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always
}