Description
We have two concerning test failures on the builders, which seem to have the same root cause:
darwin-amd64-10_14: https://build.golang.org/log/88d3fe6fbcfe0ba7110aac537e5cdcae51737d4d
openbsd-386-70: https://build.golang.org/log/79c6a4815792817f70a447fecb4557aa33b90ff0
Both of these are concerning because gopls is failing to find package metadata for a file, even after reloading (and apparently successfully loading file data).
It's suprising that files are left orphaned by the initial metadata load (in a typical run, they aren't). It's also suprising that the reloads (via reloadOrphanedFiles) do not correctly result in the requisite file associations. Logging in those test failures indicates that the loaded packages include the orphaned files, yet they continue to be reloaded (EDIT: my eyes deceived me, the paths don't match! See below).
This is likely related to my recent changes to metadata graph building. I'd like to understand this before releasing gopls@v0.9.0. Unfortunately, it seems exceedingly rare; I will see if I can add more instrumentation and reproduce via slowbots.
CC @adonovan