gojekyll
gojekyll copied to clipboard
Optimize golangci-lint CI performance
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
- Change
cache: falsetocache: truein.github/workflows/golangci-lint.yml - Test the impact on CI run times
- Consider additional optimizations if needed