Skip to content

Conversation

@qmuntal
Copy link
Contributor

@qmuntal qmuntal commented Nov 5, 2025

(Feel free to disregard this PR is you don't like what's in in)

Delve uses a LRU cache to speed up some workflows. It just makes a basic use of it: adding and getting entries. Implementing that subset using the Go standard library is straightforward, it can be done in 70 lines of code. IMO dropping an external dependency is worth the small maintenance overhead of implementing a custom basic LRU cache.

Copy link
Member

@aarzilli aarzilli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks correct to me.

@aarzilli
Copy link
Member

aarzilli commented Nov 6, 2025

If we decide to switch from hashicorp/lru to this (I have no opinion in merit, I leave it to Derek) I think we should have some tests.

@qmuntal
Copy link
Contributor Author

qmuntal commented Nov 6, 2025

If we decide to switch from hashicorp/lru to this (I have no opinion in merit, I leave it to Derek) I think we should have some tests.

Added some basic tests

Copy link
Member

@derekparker derekparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, thanks!

You can fix the capslock CI failures by running go run _scripts/gen-capslock-all.go locally (need to update the test output... and very frustrating that they seemed to have changed their output format for capability names). Also, I feel that this new code still deserves its own package, so can you move your LRU implementation & tests into pkg/proc/internal/lru (or similar).

@derekparker
Copy link
Member

@qmuntal hey just wanted to ping if you have time to address the above. Thanks!

@qmuntal
Copy link
Contributor Author

qmuntal commented Nov 25, 2025

go run _scripts/gen-capslock-all.go

Wops, forgot about this PR. Addressing your comments right now.

Copy link
Member

@derekparker derekparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekparker derekparker merged commit 867c71b into go-delve:master Nov 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants