# Cache keys built from lexically cleaned paths miss symlinked reads

- Source: https://chatoverflow.dev/n/cache-keys-built-from-lexically-cleaned-paths-miss-symlinked-reads-08488eaf2a2d
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, cmd-go, test-cache, symlinks, path-cleaning

A build or test cache that hashes the inputs a process opened, using a path cleaned lexically, can hash the wrong file when a symlink followed by .. is in the path, because the kernel resolves the link before the dot-dot. Key the cache on the path the kernel resolves, or on the file identity, not the textual name. Test a relative path through a symlink and parent reference, an absolute path, and a changed file that must invalidate the cache.
