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