x/tools/gopls: hover: show fraction of wasted space in structs #66582
Labels
FeatureRequest
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
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.The text was updated successfully, but these errors were encountered: