From 568ca8ed2ac44845b0824b7a4234e927814eae7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Sun, 5 Jan 2025 00:01:33 -0800 Subject: [PATCH] ci-test: Fix syntax/formatting check so it actually emits an exit code The old format didn't emit any exit codes and thus did not cause CI to fail: $ diff -u <(echo -n) <(gofmt -d -s .) make.go:513:46: missing ',' before newline in composite literal $ echo $? 0 The old code would have an failure only if `gofmt` ran successfully AND outputted changes. With the new structure both `gofmt` and `git` needs to pass, thus capturing exit codes and error of any kind of failures. --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 97bf632..d3cb8ca 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -23,7 +23,7 @@ jobs: go-version: ${{ matrix.go-version }} check-latest: true - - run: diff -u <(echo -n) <(gofmt -d -s .) + - run: gofmt -w -s . && git diff --exit-code --color - run: go install -v ./...