Skip to content

Commit

Permalink
ci-test: Fix syntax/formatting check so it actually emits an exit code
Browse files Browse the repository at this point in the history
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 smallest possible fix to this is to ensure gofmt output actually
goes to stdout as the original test expected:

    $ diff -u <(echo -n) <(gofmt -d -s . 2>&1)
    --- /dev/fd/63	2025-01-05 07:46:28.550632333 +0000
    +++ /dev/fd/62	2025-01-05 07:46:28.550632333 +0000
    @@ -0,0 +1 @@
    +make.go:513:46: missing ',' before newline in composite literal
    $ echo $?
    1
  • Loading branch information
ottok committed Jan 14, 2025
1 parent 0846d5a commit 4a27042
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
go-version: ${{ matrix.go-version }}
check-latest: true

- run: diff -u <(echo -n) <(gofmt -d -s .)
- run: diff -u <(echo -n) <(gofmt -d -s . 2>&1)

- run: go install -v ./...

Expand Down

0 comments on commit 4a27042

Please sign in to comment.