Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: purge empty directories from filecache #57915

Open
adonovan opened this issue Jan 18, 2023 · 0 comments
Open

x/tools/gopls: purge empty directories from filecache #57915

adonovan opened this issue Jan 18, 2023 · 0 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Jan 18, 2023

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.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jan 18, 2023
@adonovan adonovan self-assigned this Jan 18, 2023
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Jan 18, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jan 18, 2023
@dle8 dle8 modified the milestones: Unreleased, gopls/later Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants