v2.5.0-beta
Pre-releaseThis 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()
returnio.ErrUnexpectedEOF
instead ofio.EOF
on EOF if current CBOR data item is incomplete. -
PR 380: Make
Unmarshal()
andValid()
returncbor.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 toEncode()
butNewEncoder().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
-
Remove trailing whitespaces in .golangci.yml by @CodingVoid in #333
-
Update ci.yml by @fxamacker in #334
-
Remove default permissions from GitHub Actions workflows by @x448 in #341
-
Fix ci for stream mode branch by @fxamacker in #344
-
Bump github/codeql-action from 1 to 2 by @dependabot in #347
-
Mention security assessment by NCC Group by @fxamacker in #358
-
godoc.org link in Readme should point to v2 by @jdharms in #361
-
Add Go 1.19 to ci.yml test matrix by @fxamacker in #363
-
Mention 1276 repos depend on fxamacker/cbor/v2 by @x448 in #371
-
Fix EncMode example in the package comment by @creachadair in #375
New Contributors (alphabetically)
- @agaffney made their first contribution in #376
- @CodingVoid made their first contribution in #333
- @creachadair made their first contribution in #375
- @dedefer made their first contribution in #352
- @deeglaze made their first contribution in #353
- @immesys made their first contribution in #355
- @jdharms made their first contribution in #361
- @zensh made their first contribution in #335
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