From 612621fe717079472482a92fda49767d5a37b758 Mon Sep 17 00:00:00 2001 From: Yesudeep Mangalapilly <yesudeep@google.com> Date: Sun, 11 May 2025 22:15:36 -0700 Subject: [PATCH] ci(go): configure the go.yaml checks to ensure go code is properly formatted --- .github/workflows/go.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d231d7d2a8..b01da10e0f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -58,5 +58,15 @@ jobs: - name: Check if generated code is up to date run: bash .github/workflows/scripts/check-generated-go.sh + - name: Check gofmt + run: | + fmt_files=$(go fmt ./...) + if [ -n "$fmt_files" ]; then + echo "Go files are not formatted. Please run 'go fmt ./...' and commit the changes:" + echo "$fmt_files" + exit 1 + fi + working-directory: ./go + - name: Run tests run: go test -C go -v ./...