Skip to content

Optimize golangci-lint CI performance #91

@osteele

Description

@osteele

Description

The golangci-lint job currently takes ~40s while tests complete in ~17-20s. We can optimize linting performance through better caching and configuration.

Current Bottlenecks

  • Go module cache is disabled (cache: false) in lint workflow
  • Modules are re-downloaded on every run
  • Using conservative default settings

Proposed Optimizations

1. Enable Go Module Caching

Currently we have cache: false because "golangci-lint-action has its own caching", but these serve different purposes:

  • Go cache: Module downloads and build cache (currently disabled)
  • golangci-lint cache: Analysis results cache (currently enabled)

Both should be enabled.

2. Tune Concurrency

Consider adding --concurrency=<N> to args to maximize parallel linter execution.

3. Profile Slow Linters

Identify which linters are slowest and evaluate if they provide enough value.

4. Scope Optimization (optional)

Consider only checking recent changes on direct pushes too, not just PRs.

Expected Impact

  • Enable Go caching: 5-10s savings (module downloads)
  • Tune concurrency: 2-5s savings (better CPU utilization)
  • Total estimated savings: 7-15s (bringing lint time to ~25-33s)

Implementation

  1. Change cache: false to cache: true in .github/workflows/golangci-lint.yml
  2. Test the impact on CI run times
  3. Consider additional optimizations if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions