Warnings & Diagnostics¶
The extension provides two kinds of diagnostics: memory layout optimization warnings and GC pressure hints.
Optimization Warnings¶
When a struct wastes space due to sub-optimal field ordering, a yellow warning underline appears on the struct name:
These also appear in the Problems panel (Ctrl+Shift+M / Cmd+Shift+M).
Fields with large alignment (int64, float64, pointers) should be placed first to minimize padding.
GC Pressure Hints¶
When pointer fields (maps, channels, functions, pointers, strings, slices) are not grouped at the start of the struct, a blue hint underline appears:
Grouping pointer-containing fields reduces the number of bytes the garbage collector must scan.
Promotion to warnings¶
Set goStructAnalyzer.gcPressureSeverityWarning: true to show GC pressure issues as yellow warnings instead of blue hints.
Disabling¶
| Setting | Effect |
|---|---|
goStructAnalyzer.enableStructOptimizationWarnings |
Toggle all optimization warnings |
goStructAnalyzer.enableGCPressureWarnings |
Toggle GC pressure hints |