From 1c5e71fca3386aa1d90454cd6e1687e64188dd9f Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Tue, 1 Sep 2026 08:04:48 -0700 Subject: [PATCH] CI: detect untracked generated files git diff and git status -uno ignore newly generated untracked files. Check the complete working tree so generation checks cannot pass when code generation creates a new file. --- .ci.gofmt.sh | 2 +- .ci.gogenerate.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci.gofmt.sh b/.ci.gofmt.sh index b73a5f7c3..8c0b0a6a8 100755 --- a/.ci.gofmt.sh +++ b/.ci.gofmt.sh @@ -11,7 +11,7 @@ fi go run ./_readme-gofmt/main.go go generate ./... -if [ -n "$(git status -s -uno)" ]; then +if [ -n "$(git status --short)" ]; then echo "Go generate output does not match commit." echo "Did you forget to run go generate ./... ?" exit 1 diff --git a/.ci.gogenerate.sh b/.ci.gogenerate.sh index 5b5642094..6492d35f7 100755 --- a/.ci.gogenerate.sh +++ b/.ci.gogenerate.sh @@ -9,8 +9,9 @@ if [[ -z "$(go env GOMOD)" ]]; then fi go generate ./... -if [ -n "$(git diff)" ]; then +if [ -n "$(git status --short)" ]; then echo "Go generate had not been run" + git status --short git diff exit 1 fi