mirror of https://github.com/golang/go.git
According to its comment, reloadOrphanedFiles is intended to work around overlay bugs. But as of 1.16, there are no overlay bugs that we know of. So what is it still doing? Apparently, quite a bit, not much of it useful. Clean up as much as possible. - Files with no valid package declaration are ignored by the go command. There's no point trying to reload them; stop. - During metadata invalidation, we clear out all IDs for a file, even if only one of its IDs is invalidated, e.g. when a test package is removed. That leaves valid metadata for the non-test, so we don't refresh it in the workspace reload, and only catch it as an orphan. It seems to me we should only remove the invalidated ID. - If the client incorrectly sends us a didOpen for a non-Go file, we will attempt to load it as an orphaned file. Fix the regtest that did that. - TestEmptyGOPATHXTest_40825 set up an invalid GOPATH: you can't work in GOPATH/src. However, it exists to test code that no longer exists, so just delete it. After this change, almost none of the regression tests trigger orphaned file reloading. It's difficult/impractical to rule it out entirely because some of them only appear racily. Since I intend to remove the code path, I'm not too worried about more creeping in before I'm done. The only useful case is multiple ad-hoc packages. Because we only allow one "command-line-arguments" package in the workspace, if you switch between two the old one becomes orphaned. I hope to work on that soon. Change-Id: Ia355cf104280ce51f6189c6638e8da8f4aef2ace Reviewed-on: https://go-review.googlesource.com/c/tools/+/302089 Trust: Heschi Kreinick <heschi@google.com> Trust: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Heschi Kreinick <heschi@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> |
||
|---|---|---|
| .. | ||
| diagnostics_test.go | ||