Description
The kubernetes repo has multiple submodules (k8s.io/xyz
), each with a replace directive in the main module that maps them to ./staging/xyz
. The vendor
directory contains symbolic links vendor/xyz
to ../staging/xyz
. This means files and directories in staging have aliases such vendor/k8s.io/kubectl -> ../../staging/src/k8s.io/kubectl
.
I have observed that some gopls renamings cause the same edits to be applied to both aliases of the same file. If the renaming is length-preserving, this is harmless, but otherwise a renaming from A to AB results in ABB, with a repeated suffix. (Presuambly a renaming that shortened would be even more destructive.)
We need to merge edits not just based on URI equivalence (as we do already), but based on the file system's notion of equivalence, using os.SameFile or robustio.FileID.
(See also https://go.dev/cl/457615, which did the same thing for the go/analysis -fix logic.)