Skip to content

Commit 17604fe

Browse files
committed
fix(go-lint): exclude vendor/ from gofmt check
gofmt -l . scans all .go files including vendor/, which contains third-party code that should not be reformatted. Use find with -not -path './vendor/*' to skip vendor directory. go vet ./... already skips vendor/ by default.
1 parent 05cb83e commit 17604fe

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

.github/actions/go-lint/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ runs:
6363
GOFLAGS: ${{ inputs.go-flags }}
6464
run: |
6565
echo "::group::go fmt"
66-
UNFMT=$(gofmt -l . 2>&1 || true)
66+
UNFMT=$(find . -name '*.go' -not -path './vendor/*' -exec gofmt -l {} + 2>&1 || true)
6767
if [ -n "$UNFMT" ]; then
6868
echo "::error::The following files are not formatted:"
6969
echo "$UNFMT"
@@ -83,6 +83,7 @@ runs:
8383
echo "::group::go vet"
8484
go vet ./...
8585
echo "::endgroup::"
86+
# Note: go vet ./... already skips vendor/ by default
8687
8788
- name: Run golangci-lint
8889
uses: golangci/golangci-lint-action@v7

0 commit comments

Comments
 (0)