x/tools/gopls: stale diagnostic, possibly from an orphaned workspace package #43347
I encountered a strange and concerning bug in gopls yesterday (using gopls/v0.6.1), which presented as follows:
While working on the regtests, I typed
We (@stamblerre and I) therefore suspected that I somehow had an orphaned workspace package which is no longer associated with the file I was editing. If this were possible we would not invalidate this typechecked package upon edits to the file, its stale diagnostics would persist across snapshots, and it would not be part of the
So after staring at this for a bit, I'm currently at a loss. While the bug persisted in my gopls session, I unfortunately did not have the debug server enabled and was unsurprisingly not able to reproduce in a new session. Eventually, after an ~hour in the broken session, the stale diagnostic just went away.
This is likely a rare enough bug that it is relatively low impact, but its nature demonstrates that some invariant of the gopls server is being broken. I therefore think we should proceed by instrumenting gopls to assert loudly on the invariants we expect: logging errors in production builds and crashing in development builds.
The text was updated successfully, but these errors were encountered:
Check that some invariants are met when cloning the snapshot, in an attempt to catch golang/go#43347 For golang/go#43347 Change-Id: I7404509027a1b0b0085133cba4d21d1006a52a57 Reviewed-on: https://go-review.googlesource.com/c/tools/+/280698 Run-TryBot: Robert Findley <email@example.com> gopls-CI: kokoro <firstname.lastname@example.org> TryBot-Result: Go Bot <email@example.com> Trust: Robert Findley <firstname.lastname@example.org> Reviewed-by: Rebecca Stambler <email@example.com>