Skip to content

Commit 2ab81fe

Browse files
committed
ci: simplify gofmt hook to use native pre-commit file filtering
Let pre-commit pass staged Go files to gofmt instead of scanning the entire tree. Uses gofmt -w to auto-fix formatting in place. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Generated-by: Claude rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
1 parent c215353 commit 2ab81fe

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ repos:
7979
hooks:
8080
- id: go-fmt
8181
name: gofmt
82-
entry: bash -c 'out=$(gofmt -l .); [ -z "$out" ] || { echo "$out"; exit 1; }'
82+
entry: gofmt -w
8383
language: system
8484
types: [go]
85-
pass_filenames: false
8685

8786
- id: go-vet
8887
name: go vet

0 commit comments

Comments
 (0)