Summary
This release adds full support for embedded (anonymous) structs with an optimized fast path when embedding is not used, aligning struct field promotion and conflict resolution with encoding/json.
Highlights
- Added embedded struct field collection and promotion, including tag-aware precedence and ambiguity handling.
- Preserved a fast path for non-embedded structs; uses path-based access only when embedding is present.
- Added
omitemptyhandling on embedded parents, omitting promoted fields when the parent is zero ornil. - Added decoding support for embedded pointer structs with allocation when needed.
Behavior Changes
- Embedded struct fields are now promoted by default (unless the embedded field is tagged).
- Ambiguous field names from multiple embedded structs are omitted (matching
encoding/jsonbehavior). omitemptyon an embedded parent can suppress all promoted fields when the parent is zero ornil.
Tests
- Added comprehensive tests for embedded structs, tag behavior, shadowing, ambiguity, pointer embedding, and
omitempty.
Full Changelog: https://github.com/shamaton/msgpack/commits/v3.1.0