Caveat: this is an abstract issue, but sufficiently fundamental to warrant independent tracking.
In two places inside gopls, there is a notion of "previously seen" files that affects gopls behavior:
cache.View.knownFile, which is used to determine if a file is relevant to a given view
cache.snapshot.FindFile (and anything that walks the snapshot.files set), which is used to filter to relevant or active files
These notions have no intrinsic definition: by construction they are path dependent. As such, they have been a source of historical and current bugs (for example, changing configuration can invalidate the set of known files, which leads to undefined behavior). They are also a source of test flakes, which is really just a manifestation of underlying bugginess.
We should replace these with well-defined notions, on a case by case basis. For example "is a file in the workspace directory", or "is this file in a loaded package, after loading completes".
gopherbot
added
Tools
This label describes issues relating to any tools in the x/tools repository.
gopls
Issues related to the Go language server, gopls.
labels
Jan 3, 2023
Fix two bugs in TestSwitchFromGOPATHToModuleMode:
- `go mod init` was run in the wrong directory.
- on-disk change notifications raced with the main.go edit, causing us
to only encounter the problem of the previous bullet in rare cases
where the on-disk notification won the race
I've filed golang/go#57558 to track fixing the fundamental raciness of
view changes.
Fixesgolang/go#57512
Change-Id: I2b21f944377e0ba45ee7be019a28f18a334f3516
Reviewed-on: https://go-review.googlesource.com/c/tools/+/459560
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Caveat: this is an abstract issue, but sufficiently fundamental to warrant independent tracking.
In two places inside gopls, there is a notion of "previously seen" files that affects gopls behavior:
These notions have no intrinsic definition: by construction they are path dependent. As such, they have been a source of historical and current bugs (for example, changing configuration can invalidate the set of known files, which leads to undefined behavior). They are also a source of test flakes, which is really just a manifestation of underlying bugginess.
We should replace these with well-defined notions, on a case by case basis. For example "is a file in the workspace directory", or "is this file in a loaded package, after loading completes".
CC @adonovan @pjweinb
The text was updated successfully, but these errors were encountered: