Skip to content

v2.5.0-beta

Pre-release
Pre-release
Compare
Choose a tag to compare
@fxamacker fxamacker released this 03 Jan 01:12
· 335 commits to master since this release
9c7f31b

This release is larger than usual because it has been a year since last release. It adds new features, bug fixes, and 8 new contributors.

All unit tests pass (98.4% coverage). Fuzz tests passed hundreds of millions of execs. Fuzzing will continue until v2.5.0 is tagged.

Notable Changes to Review Before Upgrading

These new features and bug fixes were cherry-picked to highlight for review (for projects using older version in production).

  • PR 370: Add SimpleValue type to more fully support CBOR Simple Values, including values not assigned by IANA and...

  • PR 376: Add ByteString type to support CBOR maps with byte string keys because Go doesn't allow []byte as map keys and...

  • PR 379: Make Decoder.Decode() return io.ErrUnexpectedEOF instead of io.EOF on EOF if current CBOR data item is incomplete.

  • PR 380: Make Unmarshal() and Valid() return cbor.ExtraneousDataError (instead of ignoring extraneous data if any remain).

Notable Changes Affecting Speed or Memory Use

  • PR 335: Reuse underlying array if RawMessage has sufficient capacity.

  • PR 382: Return buffer to pool in Encode(). It adds a bit of overhead to Encode() but NewEncoder().Encode() is a lot faster and uses less memory.

Other Notable Changes:

  • PR 342: Add DecOptions.UTF8 to decode invalid UTF-8. Default is unchanged (reject invalid UTF-8 and return error).

  • PR 355 Allow MaxNestedLevels setting to be configured up to 65535.

  • PR 352, 377: Add EncOptions.NilContainersMode to encode nil Go maps and slices as either CBOR nil (default) or empty container.

  • PR 381: Add Decoder.Skip() to skip CBOR data item in CBOR Sequences (RFC 8742).

What's Changed

Most coding changes are already mentioned. Other changes include CI, comments, and docs.

(click to expand)

All Changes to Code

  • Add support for unassigned/reserved CBOR simple values by @fxamacker in #370
  • Add ByteString type to support any CBOR byte string by @fxamacker and @agaffney in #376
  • Make Decoder.Decode() return io.ErrUnexpectedEOF instead of io.EOF on EOF if CBOR data item is truncated by @fxamacker in #379
  • Fix handling of extra data in Unmarshal() & Valid() by @fxamacker in #380
  • Add Decoder.Skip() to skip CBOR data item in CBOR Sequences (RFC 8742) by @fxamacker in #381
  • Reuse underlying array if RawMessage has sufficient capacity by @zensh in #335
  • Return buffer to pool when using Encoder.Encode by @fxamacker in #382
  • Add decoding option to allow invalid UTF-8 by @fxamacker in #342
  • Allow MaxNestedLevels to be up to 65535 by @immesys in #355
  • add option to enforce nil container marshaling as empty containers by @dedefer in #352
  • Refactor NilContainersMode option by @fxamacker in #377

Changes to CI, Comments, and Docs

New Contributors (alphabetically)

Non-coding contibutions were made by opening notable issues that directly or indirectly improved this release.

  • @burdiyan opened issue and followups that led to Encode() returning buffer to pool as default behavior.
  • @espoal opened issue and followups that led to adding Skip() feature for CBOR Sequences (RFC 8742).
  • @qmuntal opened issue and @x448 added feedback that led to improved support for CBOR Simple Values.
  • @x448 opened multiple issues and provided helpful feedback in addition to his merged PR.
  • @zensh opened multiple issues and provided helpful feedback in addition to his merged PR.

Full Changelog: v2.4.0...v2.5.0-beta