Never regenerate mf.pb.go during checks; fail when it is stale (closes #71)
check / check (push) Failing after 2s
check / check (push) Failing after 2s
The test and format scripts regenerated mfer/mf.pb.go whenever mfer/mf.proto looked newer by mtime, which a fresh checkout often causes, so make check could rewrite a committed file and needed protoc. Nothing regenerates it any more except make generate (script/generate), which also records the hash of mf.proto in mfer/mf.proto.sha256. A Go test compares that hash with mf.proto and fails, naming make generate, when they differ; it needs no protoc. The Makefile's mtime rule for mf.pb.go, make clean's deletion of it and the Dockerfile's touch workarounds are removed. Model: opus-5-5
This commit is contained in:
@@ -6,19 +6,8 @@ set -eu
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
||||
|
||||
# Regenerate mfer/mf.pb.go from mfer/mf.proto if it is missing or stale
|
||||
# (mirrors the old Makefile prerequisite; the generated file is
|
||||
# committed, so this is normally a no-op).
|
||||
ensure_pb() {
|
||||
if [ ! -f mfer/mf.pb.go ] ||
|
||||
[ -n "$(find mfer/mf.proto -newer mfer/mf.pb.go 2>/dev/null)" ]; then
|
||||
(cd mfer && go generate .)
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
cd "$ROOT"
|
||||
ensure_pb
|
||||
if [ -n "$(gofmt -l .)" ]; then
|
||||
echo "gofmt: files need formatting:" >&2
|
||||
gofmt -l . >&2
|
||||
|
||||
Reference in New Issue
Block a user