Skip to content

Commit 3aac375

Browse files
committed
Fix CI formatting check
Only check *.go files in current directory
1 parent 6b6c557 commit 3aac375

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ jobs:
6262

6363
- name: Check formatting
6464
run: |
65-
# Only check .go files, not go.mod or other config files
66-
if ! gofmt -l *.go ./... 2>/dev/null | grep -q .; then
67-
echo "Code needs formatting"
68-
gofmt -d *.go ./...
65+
# Only check .go files
66+
unformatted=$(gofmt -l *.go)
67+
if [ -n "$unformatted" ]; then
68+
echo "Code needs formatting:"
69+
gofmt -d *.go
6970
exit 1
7071
fi

0 commit comments

Comments
 (0)