Skip to content

x/tools/gopls: hover: show fraction of wasted space in structs #66582

@adonovan

Description

@adonovan

https://go.dev/cl/573076 (pending) augments gopls' hover information with the size and offset of each field when viewing a struct. A recent discussion about the fieldalignment analyzer (which is disabled due to high false positives) made me wonder whether any static analysis (as opposed to dynamic analysis using the heap profiler) had anything to offer. I think it might: we could compute the size of the struct as if the fields were in space-optimal order (largest to smallest), and if this is significantly smaller than the actual size, or falls into a different allocator size class), then we could report the waste fraction too.

Metadata

Metadata

Assignees

Labels

FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions