From c2a253ab03b743bca8bbbc2237bb711e560818fb Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Tue, 1 Sep 2026 08:06:04 -0700 Subject: [PATCH] CI: propagate code generation failures Without errexit, a failed go generate command can be followed by a clean git diff and a successful script exit. Evaluate GOMOD separately so a failed go env command is propagated too. --- .ci.gogenerate.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci.gogenerate.sh b/.ci.gogenerate.sh index 5b5642094..d00055ad5 100755 --- a/.ci.gogenerate.sh +++ b/.ci.gogenerate.sh @@ -1,9 +1,12 @@ #!/usr/bin/env bash +set -euo pipefail + # If GOMOD is defined we are running with Go Modules enabled, either # automatically or via the GO111MODULE=on environment variable. Codegen only # works with modules, so skip generation if modules is not in use. -if [[ -z "$(go env GOMOD)" ]]; then +gomod="$(go env GOMOD)" +if [[ -z "$gomod" ]]; then echo "Skipping go generate because modules not enabled and required" exit 0 fi