Files
dnswatcher/script/fmt-check
T
clawbot e8b40062da
check / check (push) Successful in 4m6s
build: re-vendor canonical files from prompts dd4027b (closes #257)
The canonical files are fetched whole from sneak/prompts at dd4027b.
Kept after the canonical content: the livednstest deny entry in
.golangci.yml, /bin in .dockerignore, this repo's own .gitignore lines
and a [*.go] tab section in .editorconfig. The workflow keeps its
concurrency block and persist-credentials: false. Lint and test are
phases of the Dockerfile (golangci-lint v2.14.0; tests on the Debian
Go 1.25.7 image as an ordinary user, with the same flags); the build
stage depends on both and stamps the version the canonical way.
Dockerfile.lint is gone; the prettier stages of Dockerfile.fmt moved
into the Dockerfile. Every scripted docker build passes --no-cache;
script/cibuild bootstraps, runs script/check, then builds the image.
script/fmt-check absorbs fmt-check-go and fmt-check-markdown.

Model: opus-5-5
2026-10-06 04:29:48 +02:00

38 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# script/fmt-check: check formatting (read-only). Same tools and scope
# as script/fmt, but fails instead of writing and names what it would
# change: the Go on the host, the markdown with prettier in the
# Dockerfile's fmt-check stage.
#
# --no-cache because a cached check layer is a check that did not run.
# The tag makes each build replace the previous image instead of leaving
# a dangling one behind.
set -eu
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
# goimports v0.42.0, 2026-08-07. Must match script/fmt.
GOIMPORTS_REF="golang.org/x/tools/cmd/goimports@009367f5c17a8d4c45a961a3a509277190a9a6f0"
main() {
cd "$ROOT"
files="$(gofmt -s -l .)"
if [ -n "$files" ]; then
echo "gofmt: files not formatted:" >&2
echo "$files" >&2
exit 1
fi
files="$(go run "$GOIMPORTS_REF" -l .)"
if [ -n "$files" ]; then
echo "goimports: files not formatted:" >&2
echo "$files" >&2
exit 1
fi
docker build --no-cache \
--target fmt-check \
-t "$("$SCRIPT_DIR/projectname")-fmt-check" .
}
main "$@"