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

Closed
adonovan opened this issue Jan 18, 2023 · 1 comment
Closed

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

adonovan opened this issue Jan 18, 2023 · 1 comment
Assignees
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

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
@gopherbot
Copy link

Change https://go.dev/cl/468539 mentions this issue: gopls/internal/lsp/filecache: purge empty directories

@golang golang locked and limited conversation to collaborators Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

No branches or pull requests

3 participants