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
cbortag, the option is always honored. When specified in thejsontag, 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 https://github.com/fxamacker/cbor/pull/626
- Replace
interface{}withanyby @fxamacker in https://github.com/fxamacker/cbor/pull/627 - Replace
reflect.Ptrwithreflect.Pointerby @fxamacker in https://github.com/fxamacker/cbor/pull/628 - Replace
reflect.PtrTowithreflect.PointerToby @fxamacker in https://github.com/fxamacker/cbor/pull/629 - Add omitzero support by @liggitt in https://github.com/fxamacker/cbor/pull/644
- Update error handling in
RawTag.UnmarshalCBOR(), etc. to matchcbor.Unmarshal()by @fxamacker in https://github.com/fxamacker/cbor/pull/645 - Optimize internal calls to
UnmarshalCBOR()forByteString,RawTag,SimpleValueby @fxamacker in https://github.com/fxamacker/cbor/pull/647
Other Changes
馃攳 Details
- Bump github/codeql-action from 3.25.10 to 3.25.11 by @dependabot in https://github.com/fxamacker/cbor/pull/562
- Bump actions/setup-go from 5.0.1 to 5.0.2 by @dependabot in https://github.com/fxamacker/cbor/pull/564
- Bump github/codeql-action from 3.25.11 to 3.25.12 by @dependabot in https://github.com/fxamacker/cbor/pull/565
- Bump github/codeql-action from 3.25.12 to 3.25.14 by @dependabot in https://github.com/fxamacker/cbor/pull/567
- Bump github/codeql-action from 3.25.14 to 3.25.15 by @dependabot in https://github.com/fxamacker/cbor/pull/569
- Bump github/codeql-action from 3.25.15 to 3.26.0 by @dependabot in https://github.com/fxamacker/cbor/pull/571
- Bump govulncheck from 1.0.4 to 1.1.3 by @fxamacker in https://github.com/fxamacker/cbor/pull/572
- Bump github/codeql-action from 3.26.0 to 3.26.2 by @dependabot in https://github.com/fxamacker/cbor/pull/575
- Add go1.23 to ci.yml by @fxamacker in https://github.com/fxamacker/cbor/pull/573
- Bump github/codeql-action from 3.26.2 to 3.26.6 by @dependabot in https://github.com/fxamacker/cbor/pull/580
- Mention new TinyGo feature branch in README by @fxamacker in https://github.com/fxamacker/cbor/pull/582
- Bump github/codeql-action from 3.26.6 to 3.26.8 by @dependabot in https://github.com/fxamacker/cbor/pull/585
- Bump github/codeql-action from 3.26.8 to 3.26.9 by @dependabot in https://github.com/fxamacker/cbor/pull/586
- Bump actions/checkout from 4.1.7 to 4.2.0 by @dependabot in https://github.com/fxamacker/cbor/pull/587
- README: update benchmark comparisons, etc. by @fxamacker in https://github.com/fxamacker/cbor/pull/588
- Bump github/codeql-action from 3.26.9 to 3.26.11 by @dependabot in https://github.com/fxamacker/cbor/pull/590
- README: update to clarify CBOR benchmark comparison and resolve nits by @fxamacker in https://github.com/fxamacker/cbor/pull/591
- README: fix broken link to svg file by @fxamacker in https://github.com/fxamacker/cbor/pull/592
- Bump github/codeql-action from 3.26.11 to 3.26.12 by @dependabot in https://github.com/fxamacker/cbor/pull/594
- Bump actions/checkout from 4.2.0 to 4.2.1 by @dependabot in https://github.com/fxamacker/cbor/pull/593
- Bump github/codeql-action from 3.26.12 to 3.26.13 by @dependabot in https://github.com/fxamacker/cbor/pull/595
- Bump github/codeql-action from 3.26.13 to 3.27.0 by @dependabot in https://github.com/fxamacker/cbor/pull/596
- Bump actions/checkout from 4.2.1 to 4.2.2 by @dependabot in https://github.com/fxamacker/cbor/pull/597
- Bump actions/setup-go from 5.0.2 to 5.1.0 by @dependabot in https://github.com/fxamacker/cbor/pull/598
- Bump github/codeql-action from 3.27.0 to 3.27.4 by @dependabot in https://github.com/fxamacker/cbor/pull/602
- Bump github/codeql-action from 3.27.4 to 3.27.6 by @dependabot in https://github.com/fxamacker/cbor/pull/604
- Bump github/codeql-action from 3.27.6 to 3.27.7 by @dependabot in https://github.com/fxamacker/cbor/pull/605
- Bump actions/setup-go from 5.1.0 to 5.2.0 by @dependabot in https://github.com/fxamacker/cbor/pull/606
- Bump github/codeql-action from 3.27.7 to 3.27.9 by @dependabot in https://github.com/fxamacker/cbor/pull/607
- Bump github/codeql-action from 3.27.9 to 3.28.0 by @dependabot in https://github.com/fxamacker/cbor/pull/608
- Bump github/codeql-action from 3.28.0 to 3.28.1 by @dependabot in https://github.com/fxamacker/cbor/pull/609
- Bump actions/setup-go from 5.2.0 to 5.3.0 by @dependabot in https://github.com/fxamacker/cbor/pull/610
- Bump github/codeql-action from 3.28.1 to 3.28.4 by @dependabot in https://github.com/fxamacker/cbor/pull/614
- Bump github/codeql-action from 3.28.4 to 3.28.8 by @dependabot in https://github.com/fxamacker/cbor/pull/618
- Bump github/codeql-action from 3.28.8 to 3.28.9 by @dependabot in https://github.com/fxamacker/cbor/pull/619
- .github: Bump govulncheck from 1.1.3 to 1.1.4 by @fxamacker in https://github.com/fxamacker/cbor/pull/620
- .github: Require 97% or more code coverage by @fxamacker in https://github.com/fxamacker/cbor/pull/621
- Add missing copyright notice to a few files by @fxamacker in https://github.com/fxamacker/cbor/pull/630
- Bump github/codeql-action from 3.28.9 to 3.28.10 by @dependabot in https://github.com/fxamacker/cbor/pull/631
- Bump github/codeql-action from 3.28.10 to 3.28.11 by @dependabot in https://github.com/fxamacker/cbor/pull/633
- Bump actions/setup-go from 5.3.0 to 5.4.0 by @dependabot in https://github.com/fxamacker/cbor/pull/639
- Bump github/codeql-action from 3.28.11 to 3.28.12 by @dependabot in https://github.com/fxamacker/cbor/pull/641
- Bump github/codeql-action from 3.28.12 to 3.28.13 by @dependabot in https://github.com/fxamacker/cbor/pull/642
- README: fix typo in code example in Struct Tags section by @sschulz-t in https://github.com/fxamacker/cbor/pull/637
- Update docs for cbor v2.8.0 by @fxamacker in https://github.com/fxamacker/cbor/pull/649
New Contributors
- @sschulz-t made their first contribution in https://github.com/fxamacker/cbor/pull/637
- @liggitt made their first contribution in https://github.com/fxamacker/cbor/pull/644
Full Changelog: https://github.com/fxamacker/cbor/compare/v2.7.0...v2.8.0