Skip to content

v3.1.0

Latest

Choose a tag to compare

@shamaton shamaton released this 06 Feb 14:24
20ba54b

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 omitempty handling on embedded parents, omitting promoted fields when the parent is zero or nil.
  • 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/json behavior).
  • omitempty on an embedded parent can suppress all promoted fields when the parent is zero or nil.

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