x/tools/gopls: purge empty directories from filecache #57915
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
The filecache removes files but not directories. At 1KB each, it's possible for empty directories to eventually consume hundreds of megabytes, though this is only likely for a small handful of heavy gopls developers who run novel test executables every day for months, and for the CI builders.
We should delete empty directories too. The challenge is to do so in a way that doesn't race with filecache.Set's call to MkdirAll. Probably the best approach is to enumerate the immediate children of goplsDir, each representing a unique gopls executable, test whether the entire tree is both old and contains no regular files, and then delete it if so. This need be done at most once per directory per process to ensure eventual deletion.
This is a low-priority task.
The text was updated successfully, but these errors were encountered: