All notable changes to the Go Memory Layout Visualizer extension will be documented in this file.
- Quick Fix code action: optimization is now available via the standard
lightbulb (
Ctrl+./Cmd+.) on any reorderable struct, in addition to the existing CodeLens. - Diagnostic provider: high-padding, optimization-eligible, and cache-line-crossing structs are surfaced in the Problems panel.
- Status bar item: shows the total saveable bytes for the active Go file at a glance, click-through opens the layout view.
- New command
Go: Compare Struct Layout Across Architecturesopens a side-by-side amd64/arm64/386 view for the struct at the cursor. - Same-file type alias support, including aliases declared in
type (...)blocks. - Named-interface sizing:
erroris built in as a 2-word value, and anytype X interface { ... }declared in the same file is registered and sized correctly (16 bytes on amd64/arm64, 8 bytes on 386). - Anonymous inline struct fields:
Header struct { ... }field types are now parsed and sized recursively, including multi-line declarations. - A 28-case automated test suite covering layout sizing, alias resolution, interfaces, anonymous structs, nested and embedded structs, cache-line detection, multi-architecture optimizer behaviour, and array overflow guards.
- GitHub Actions CI running compile, lint, and tests on Node 20 and 22.
- Incremental TypeScript builds via
tsBuildInfoFile, cutting warm rebuilds by roughly a third.
- ESLint
no-case-declarationsfailure in the memory calculator. - Go slice sizing now uses the correct three-word slice header on each supported architecture (24 B on amd64/arm64, 12 B on 386).
complex64is now 8 bytes with 4-byte alignment, matching Go layout rules.unsafe.Pointeris correctly pointer-sized.errorand other named interfaces no longer collapse to a single word.- Optimizer emits grouped field declarations like
A, B uint8exactly once. - Interface declarations are no longer accidentally treated as structs by the parser when they precede a real struct in the same file.
- Critical: Fixed DOM-based XSS vulnerabilities in Workspace Analysis and Memory Layout webviews
- Critical: Fixed private member access bypass via bracket notation
- High: Fixed CSV formula injection in exported reports
- High: Fixed ReDoS vulnerabilities in struct field and embedded field regex patterns
- High: Converted synchronous file I/O to async to prevent extension host blocking
- High: Added resource limits to workspace analyzer (1,000 files max, 1MB per file, 500 results)
- Medium: Added Content Security Policy headers to all webview panels
- Medium: Fixed information disclosure in error messages
- Medium: Set secure file permissions (0o600) on exported files
- Medium: Added integer overflow protection in array size calculations
- Medium: Fixed Markdown injection in hover provider and editor decorations
- Medium: Added mutex locking to prevent race conditions in decoration updates
- Medium: Added recursion depth limits for circular struct references
- Medium: Fixed XSS in documentation site calculator
- Low: Added architecture configuration validation
- Security advisory page on documentation site
- HTML, Markdown, and CSV escaping utilities for user-controlled content
- Configurable constants for resource limits and timeouts
- Published comprehensive security advisory with remediation timeline
- Added JSDoc comments to GoParser and MemoryCalculator classes
- Cache line visualization: Shows which cache line (64-byte) each field occupies
- Cache line crossing detection: Warns when fields span multiple cache lines (performance issue)
- Workspace memory analyzer: New command
Go: Analyze Workspace Memory Layoutscans all Go files for optimization opportunities - Hot field detection: Identifies fields that cross cache line boundaries (false sharing risk)
- Cache line breakdown in memory layout view showing bytes used vs padding per line
- New example file
cache-lines.godemonstrating cache line issues
- Inline annotations now show cache line number for each field (e.g.,
[L0],[L1]) - Fields crossing cache lines highlighted with distinct warning style
- Hover tooltips explain cache line crossing performance implications
- Memory layout panel includes cache line breakdown table
Go: Analyze Workspace Memory Layout- Scans entire workspace for:- Structs with excessive padding
- Optimization opportunities (bytes saveable)
- Cache line boundary issues
- Hot fields that may cause false sharing
- Fixed path traversal vulnerability in export function
- Added path normalization and validation before file writes
- Implemented parent directory existence check
- Added write verification to ensure file integrity
- Set explicit file permissions (0o644) for exported files
- Added error handling for file export operations
- Fixed deprecated
workspace.rootPathusage, now usesworkspaceFolders - Export success message no longer exposes full file path
- Nested struct support: Automatically calculates memory layout for structs containing other custom structs
- Embedded field handling: Properly detects and analyzes embedded fields (promoted fields)
- Export memory layout reports: New command to export detailed struct analysis to JSON, Markdown, or CSV formats
- Example files demonstrating nested structs and embedded fields
- Struct registry for tracking custom type definitions across the codebase
- Parser now performs two-pass analysis to register all struct definitions before calculating layouts
- Memory calculator recursively resolves nested custom struct sizes
- Improved field detection to handle embedded fields without explicit names
- Added
StructDefinitionandExportFormatinterfaces - Implemented struct registry in
MemoryCalculatorwithregisterStruct()andclearStructRegistry()methods - Added
registerStructDefinitions()private method toGoParserfor first-pass analysis - New export command with multiple format support (JSON/Markdown/CSV)
- Enhanced field parsing regex to detect embedded fields
- Initial release
- Real-time memory layout visualization for Go structs
- Inline annotations showing byte offsets, sizes, and padding
- Multi-architecture support (amd64, arm64, 386)
- Hover provider with detailed field information
- CodeLens provider for one-click struct optimization
- Automatic field reordering to minimize memory usage
- Padding detection and highlighting
- Commands:
Go: Optimize Struct Memory LayoutGo: Show Memory LayoutGo: Toggle Architecture
- Configuration options:
- Default architecture selection
- Toggle inline annotations
- Padding warning threshold
- Cache line warnings
- Supports all Go primitive types (bool, int8-64, uint8-64, float32/64, complex64/128)
- Handles pointers, slices, arrays, maps, channels, interfaces
- Smart field ordering by alignment and size
- Visual padding warnings with configurable thresholds
- Side-by-side memory layout comparison panel
- Initial test coverage for calculator, parser, and optimizer
- Built with TypeScript
- Zero external runtime dependencies
- Follows Go's memory layout rules precisely
- Accurate padding calculation
- Support for embedded fields and complex types