tools/internal/persistent
Robert Findley 36c4f987d2 gopls/internal/lsp/cache: simplify tracking of snapshot directories
Great care was taken to track known directories in the snapshot without
blocking in snapshot.Clone, introducing significant complexity.

This complexity can be avoided by instead keeping track of observed
directories as files are set in the snapshot. These directories need
only be reset when files are deleted from the snapshot, which is a
relatively rare event.

Also rename filesMap->fileMap, and move to filemap.go, with a new unit
test.

This reduces some path dependence on seen files, as the set of
directories is well defined and depends only on the files in the
snapshot. Previously, when a file was removed, gopls called Stat to
check if the directory still existed, which leads to path dependence: an
add+remove was not the same as nothing at all.

Updates golang/go#57558

Change-Id: I5fd89ce870fa7d8afd19471d150396b1e4ea8875
Reviewed-on: https://go-review.googlesource.com/c/tools/+/525616
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-05 21:59:27 +00:00
..
map.go gopls/internal/lsp/cache: simplify tracking of snapshot directories 2023-09-05 21:59:27 +00:00
map_test.go internal/persistent: use generics 2023-09-01 18:12:00 +00:00
set.go internal/persistent: add Set 2023-09-01 21:07:23 +00:00
set_test.go internal/persistent: add Set 2023-09-01 21:07:23 +00:00