Skip to content

fix: don't block commits when a project uses custom golangci-lint linters - #23

Merged
gonzaloserrano merged 1 commit into
mainfrom
fix/precommit-custom-golangci-linters
Jun 1, 2026
Merged

gonzaloserrano merged 1 commit into
mainfrom
fix/precommit-custom-golangci-linters

Conversation

@gonzaloserrano

Copy link
Copy Markdown
Owner

The gopilot pre-commit hook ran the golangci-lint on PATH, which only knows the linters compiled into it. Projects that add custom/private linters via golangci-lint's module plugin system build a dedicated binary (golangci-lint custom → ./custom-gcl); against those repos the PATH binary exits with "unknown linters" and blocked every single commit.

resolve_golangci() now picks the right binary: GOPILOT_GOLANGCI_LINT if set, else detect .custom-gcl.yml and run the binary named by its name/destination fields, else fall back to PATH. When the config exists but the binary isn't built yet, lint is skipped with a note instead of running the wrong binary — building inside the 120s PreToolUse hook would be slow and fragile. The module plugin system is now documented in the linting reference, with a pointer from SKILL.md.

…ters

The pre-commit hook ran the golangci-lint on PATH, which doesn't know linters
that projects add via the module plugin system. On those repos it exited with
"unknown linters" and blocked every commit.

resolve_golangci() now prefers a project's custom build: honor
GOPILOT_GOLANGCI_LINT if set, else detect .custom-gcl.yml and run the binary
named by its name/destination fields, else fall back to PATH. When the config
exists but the binary isn't built, skip lint with a note rather than running
the wrong binary (building inside the hook timeout is fragile).

Document the module plugin system in the linting reference and SKILL.md.
@gonzaloserrano
gonzaloserrano marked this pull request as ready for review June 1, 2026 15:26
@gonzaloserrano
gonzaloserrano merged commit 583460e into main Jun 1, 2026
2 checks passed
@gonzaloserrano
gonzaloserrano deleted the fix/precommit-custom-golangci-linters branch June 1, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant