Parallelize cache key computation

Author: jerenkrantzCreated Mar 30, 2026Updated Apr 12, 2026
Labelsenhancement

Welcome

How did you install golangci-lint?

go install

Your feature request related to a problem? Please describe

Cache key computation (loadIssuesFromCache) can take 600ms+ even for a single-package run because it recursively hashes every file in every transitive dependency, sequentially, on one goroutine. The global mutex in FileHash further serializes concurrent callers.

Describe the solution you'd like

  • Replace hashFileCache global mutex with sync.Map + singleflight.Group for lock-free cache hits and deduplicated concurrent misses
  • Hash all files within a package concurrently in computePkgHash
  • Add PrecomputePackageHashes that walks the full dependency graph in topological order, computing hashes leaf-to-root across all available cores

Describe alternatives you've considered

We confirmed caching of go build and lint caching is present - a significant amount of time during lint is the serial processing of the hashes to compute whether the caches are valid.

Additional context

Draft PR that speeds up hash computation via parallelization in #6468.

Supporter