You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A snapshot caches the content of every file it has read, to keep derived calculations such as type-checked packages coherent. But go list reads disk, not the cache, so the two can diverge whenever a closed file changes on disk without a corresponding didChangeWatchedFiles event. #64235 is one symptom (repro and mechanism); #63822 is probably another.
In other words, we hold every workspace file in memory to defend against incoherence, and it isn't sufficient: with the current go command APIs there is no way to guarantee that go list and gopls observe the same file state. We should stop paying the memory cost for a guarantee we don't get, and instead make incoherence recoverable.
Concretely:
Detect the inconsistency by checking for inconsistent metadata from Load, or unexpected file content changes. It would be nice if the go command returned a manifest of file identities for files it read.
Recover by recreating the view from scratch; we've so heavily optimized start up time so that this should be possible.
A snapshot caches the content of every file it has read, to keep derived calculations such as type-checked packages coherent. But
go listreads disk, not the cache, so the two can diverge whenever a closed file changes on disk without a correspondingdidChangeWatchedFilesevent. #64235 is one symptom (repro and mechanism); #63822 is probably another.In other words, we hold every workspace file in memory to defend against incoherence, and it isn't sufficient: with the current go command APIs there is no way to guarantee that
go listand gopls observe the same file state. We should stop paying the memory cost for a guarantee we don't get, and instead make incoherence recoverable.Concretely:
Load, or unexpected file content changes. It would be nice if thegocommand returned a manifest of file identities for files it read.Alternatives: