check / check (push) Waiting to run
The Makefile is now one shim per script/ entrypoint, in the order of the canonical model Makefile, plus build, generate and fuzz. The new script/build writes bin/mfer with the urfave_cli_no_docs tag and the git describe revision that script/docker stamps. script/generate now adds the Go bin directory to PATH itself, and the Docker lint stage calls script/gofumpt --check directly. Removed: the tarball-caching rules and their ignore entries, godoc, ci, fixme, clean, run, default, fmt-check-go, fmt-check-md, and bin/gitrev.sh, which only the Makefile called. Model: opus-5-5
45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# script/gofumpt: run gofumpt over this repo's Go files.
|
|
#
|
|
# Takes exactly one mode argument, --write or --check, and runs the same
|
|
# gofumpt version over the same files in both modes. script/fmt and
|
|
# script/fmt-check both go through here, and so does the Docker lint
|
|
# stage, so what gets formatted and what gets verified cannot drift
|
|
# apart.
|
|
set -eu
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
|
|
# gofumpt v0.12.0, 2026-10-04. `go run` fetches and builds exactly this
|
|
# version, so neither a developer machine nor the lint image needs
|
|
# gofumpt installed.
|
|
GOFUMPT="mvdan.cc/gofumpt@v0.12.0"
|
|
|
|
usage() {
|
|
echo "usage: script/gofumpt --write|--check" >&2
|
|
exit 2
|
|
}
|
|
|
|
main() {
|
|
[ "$#" -eq 1 ] || usage
|
|
cd "$ROOT"
|
|
# Every Go file in the repo. gofumpt holds generated files, such as
|
|
# mfer/mf.pb.go, to gofmt's rules only.
|
|
case "$1" in
|
|
--write) go run "$GOFUMPT" -l -w . ;;
|
|
--check)
|
|
# Own line: a failing command inside `[ -n "$(...)" ]` does
|
|
# not trip `set -e`, so a gofumpt that never ran would pass.
|
|
unformatted="$(go run "$GOFUMPT" -l .)"
|
|
if [ -n "$unformatted" ]; then
|
|
echo "gofumpt: files need formatting (run make fmt):" >&2
|
|
echo "$unformatted" >&2
|
|
exit 1
|
|
fi
|
|
;;
|
|
*) usage ;;
|
|
esac
|
|
}
|
|
|
|
main "$@"
|