-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Welcome
- Yes, I've searched similar issues on GitHub and didn't find any.
- I agree to follow this project's Code of Conduct
How did you install golangci-lint?
go install
Your feature request related to a problem? Please describe
golangci-lint's package cache appears to be path-sensitive.
I'm seeing cache misses across identical checkouts/worktrees when the repo lives at a different absolute path, even with the same contents, config, Go version, and shared GOLANGCI_LINT_CACHE.
This matters more now because ephemeral git worktrees are increasingly common in agent-driven workflows.
Describe the solution you'd like
I would like different git workspaces to use the same cache
Describe alternatives you've considered
None
Additional context
This seems to be because:
internal/cache/cache.goincludes both file path and file hash in the package key:
fmt.Fprintf(key, "file %s %x\n", f, h)go/packagesprovides absoluteCompiledGoFilespaths.
So identical repos at different absolute paths get different cache keys.
Minimal repro:
- Warm cache in worktree A.
- Create worktree B for the same commit at a different absolute path.
- Run the same
golangci-lint run ...command. - Package analysis runs again instead of reusing cache.
Supporter
- I am a sponsor/backer of this project.
Reactions are currently unavailable