8000 Release v2.8.0 · fxamacker/cbor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

v2.8.0

Latest
Compare
Choose a tag to compare
@fxamacker fxamacker released this 30 Mar 20:36
· 23 commits to master since this release
cbe7442

v2.8.0 adds omitzero struct tag option, fixes and deprecates 3 functions, and bumps requirements to go 1.20+.

Many thanks to @liggitt for contributing the omitzero support!

The "omitzero" option omits zero values from encoding, matching stdlib encoding/json behavior.
When specified in the cbor tag, the option is always honored.
When specified in the json tag, the option is honored when building with Go 1.24+.

This release fixes 3 functions (when called directly by user apps) to use same error handling on bad input as cbor.Unmarshal():

  • RawTag.UnmarshalCBOR() (thanks @thomas-fossati for reporting this!)
  • ByteString.UnmarshalCBOR()
  • SimpleValue.UnmarshalCBOR()

This release also deprecates those 3 functions because they were initially created for internal use. Please use Unmarshal() or UnmarshalFirst() instead.

To preserve backward compatibility, the deprecated functions were added to fuzz tests and will not be removed in v2.x.

What's Changed

  • go: update go.mod and ci.yml to require go1.20 or newer (was go1.17) by @fxamacker in #626
  • Replace interface{} with any by @fxamacker in #627
  • Replace reflect.Ptr with reflect.Pointer by @fxamacker in #628
  • Replace reflect.PtrTo with reflect.PointerTo by @fxamacker in #629
  • Add omitzero support by @liggitt in #644
  • Update error handling in RawTag.UnmarshalCBOR(), etc. to match cbor.Unmarshal() by @fxamacker in #645
  • Optimize internal calls to UnmarshalCBOR() for ByteString, RawTag, SimpleValue by @fxamacker in #647

Other Changes

🔍 Details

New Contributors

Full Changelog: v2.7.0...v2.8.0

0