Skip to content

fix: pin golangci-lint version and enable only-new-issues for PRs - #68

Merged
michaelpeterswa merged 1 commit into
mainfrom
fix/golangci-lint-pr-performance
Apr 15, 2026
Merged

michaelpeterswa merged 1 commit into
mainfrom
fix/golangci-lint-pr-performance

Conversation

@cnewell0

@cnewell0 cnewell0 commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Problem

The lint job in go_app_pull_requests.yml takes ~5.5 minutes on repos with large dependency trees (e.g., Kochava/mcp with 143 deps). golangci-lint must compile the entire dependency tree for static analysis on every PR run, even when only a handful of files changed.

Additionally, version: latest is used, which the golangci-lint-action README explicitly warns against:

We recommend using a fixed version to guarantee reproducibility.

Using latest means a new golangci-lint release can break CI across all repos without any code changes, and invalidates the action's cache on every release.

Changes

Three targeted changes to the lint job only:

  1. Pin version: v2.1.6 instead of latest — guarantees reproducible builds and stable cache hits
  2. Add only-new-issues: true — PRs only flag lint issues introduced by the PR, not pre-existing debt. This is the recommended configuration for PR checks per the official docs.
  3. Add fetch-depth: 0 to the checkout step — required for only-new-issues to diff against the base branch

Impact

  • Applies to all repos using this shared workflow (~141 repos)
  • PRs will get faster lint feedback (seconds instead of minutes for large repos)
  • Pre-existing lint issues will no longer block unrelated PRs (clean them up via dedicated lint-fix PRs instead)
  • No changes to test, docker-build, commitlint, or any other jobs

References

🤖 Generated with Claude Code

- Pin golangci-lint to v2.1.6 instead of `latest` for reproducibility
- Add `only-new-issues: true` so PRs only flag newly introduced issues
- Add `fetch-depth: 0` to checkout so git diff works for new-issue detection

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@michaelpeterswa
michaelpeterswa merged commit 7c3c892 into main Apr 15, 2026
@michaelpeterswa
michaelpeterswa deleted the fix/golangci-lint-pr-performance branch April 15, 2026 19:15
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.

2 participants