Faye Amacker
d29ad7351b
Merge pull request #684 from fxamacker/fxamacker/update-readme-for-v2.9.0
...
govulncheck / Check (push) Has been cancelled
cover ≥97% / Coverage (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.20, macos-latest) (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.20, ubuntu-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.20, windows-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.21, macos-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.21, ubuntu-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.21, windows-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.22, macos-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.22, ubuntu-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.22, windows-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.23, macos-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.23, ubuntu-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.23, windows-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.24, macos-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.24, ubuntu-latest) (push) Has been cancelled
ci / test ${{matrix.os}} go-${{ matrix.go-version }} (1.24, windows-latest) (push) Has been cancelled
linters / Lint (push) Has been cancelled
Update README for v2.9.0 and add Red Hat as a user
2025-07-13 23:00:34 -05:00
Faye Amacker
6a631fa250
Update README for v2.9.0 and add Red Hat as a user
...
CodeQL / Analyze (go) (push) Has been cancelled
govulncheck / Check (push) Has been cancelled
Added IBM and Red Hat to the top of README. Red Hat OpenShift uses fxamacker/cbor and two Red Hat employees contributed code to this project.
Removed some companies from top of README. E.g., the only Mozilla project that was using fxamacker/cbor was handed over to Veraison (a project of Confidential Computing Consortium).
Added a note about "toarray" struct tag option making the encoder ignore "omitempty" and "omitzero" to prevent the encoded array element positions from changing. This allows decoder to identify the Go struct field by array element position.
2025-07-13 20:59:47 -05:00
Faye Amacker
8c8d4c3ce4
Merge pull request #682 from benluddy/textunmarshaler-bytestringtostring
...
Use TextUnmarshaler on byte strings with ByteStringToStringAllowed.
2025-07-12 18:06:22 -05:00
Ben Luddy
9bdebd2c0b
Use TextUnmarshaler on byte strings with ByteStringToStringAllowed.
...
Decode modes that allow unmarshaling CBOR byte strings into Go strings and recognize
TextUnmarshalers should also allow unmarshaling CBOR byte strings into TextUnmarshalers. When
interoperating with an encode mode that marshals Go strings to CBOR byte strings, this preserves
roundtrippability of TextMarshaler -> CBOR text string -> Go string -> CBOR byte string ->
TextUnmarshaler.
Signed-off-by: Ben Luddy <bluddy@redhat.com>
2025-07-11 13:20:10 -04:00
Faye Amacker
a89c3ce6ea
Merge pull request #680 from fxamacker/dependabot/github_actions/github/codeql-action-3.29.2
...
Bump github/codeql-action from 3.29.0 to 3.29.2
2025-07-05 10:33:49 -05:00
dependabot[bot]
7ef1742b5b
Bump github/codeql-action from 3.29.0 to 3.29.2
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3.29.0 to 3.29.2.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](ce28f5bb42...181d5eefc2 )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.29.2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-07-01 12:05:04 +00:00
Faye Amacker
2d79f19334
Merge pull request #678 from fxamacker/fxamacker/refactor-tests-and-fix-spelling-in-comments
...
Refactor tests and update comments
2025-06-29 22:36:42 -05:00
Faye Amacker
0b94ce794b
Fix comments to use one "l" in marshal*
...
CodeQL / Analyze (go) (push) Has been cancelled
govulncheck / Check (push) Has been cancelled
This commit updates the spelling of words containing "marshal"
to use just one "l" instead of "ll". For example:
- marshalling -> marshaling
- marshalled -> marshaled
- etc.
This spelling change follows the convention used by Go.
2025-06-29 20:06:59 -05:00
Faye Amacker
508be9165f
Rename two test funcs that can panic
...
This commit renames two test funcs to begin with "must"
if they can panic:
- hexDecode() -> mustHexDecode()
- bigIntOrPanic() -> mustBigInt()
2025-06-29 19:51:48 -05:00
Faye Amacker
9251397c64
Refactor test to use fmt.Appendf
2025-06-29 19:48:30 -05:00
Faye Amacker
b4af226c7d
Refactor tests to improve readability
...
This commit replaces positional field initialization in test cases
with named field initialization to improve readability.
While at it, also remove tests that were commented out.
2025-06-29 19:43:04 -05:00
Faye Amacker
4e825ca4d2
Merge pull request #673 from benluddy/json-interface-transcoding
...
Add optional support for json.Marshaler and json.Unmarshaler via transcoding
2025-06-17 19:10:27 -05:00
Ben Luddy
ba129ebd42
Add optional support for json.Unmarshaler.
...
Users can provide a function to transcode an encoded CBOR data item to JSON. If provided, then
unmarshaling into a value whose type implements json.Unmarshaler, but not cbor.Unmarshaler, will
first transcode the input bytes to JSON and then invoke UnmarshalJSON on the destination value.
Signed-off-by: Ben Luddy <bluddy@redhat.com>
2025-06-17 10:45:07 -04:00
Ben Luddy
d8e0aa63e6
Add optional encoding support for json.Marshaler.
...
If the user provides a JSON-to-CBOR transcode function, a value whose type implements json.Marshaler
and not cbor.Marshaler will be encoded by first calling its MarshalJSON method, then transcoding the
result to CBOR.
Signed-off-by: Ben Luddy <bluddy@redhat.com>
2025-06-17 10:44:47 -04:00
Faye Amacker
a8dbe3e5c3
Merge pull request #672 from benluddy/text-un-marshaler
...
Add options to support TextMarshaler and TextUnmarshaler
2025-06-16 18:23:29 -05:00
Ben Luddy
db9afc542a
Replace empty encode mode test case names.
2025-06-16 09:43:57 -04:00
Ben Luddy
bf9e7d09e2
Add option to decode text strings into encoding.TextUnmarshalers.
...
The default retains the existing behavior and ignores TextUnmarshaler implementations.
Signed-off-by: Ben Luddy <bluddy@redhat.com>
2025-06-16 09:43:57 -04:00
Ben Luddy
7a9dbd0b0a
Add option to marshal encoding.TextMarshalers to CBOR text strings.
...
The default behavior (encoding.TextMarshaler not recognized) remains unchanged.
Signed-off-by: Ben Luddy <bluddy@redhat.com>
2025-06-16 09:43:57 -04:00
Faye Amacker
d81767dfcc
Merge pull request #674 from fxamacker/dependabot/github_actions/github/codeql-action-3.29.0
...
Bump github/codeql-action from 3.28.19 to 3.29.0
2025-06-14 10:23:59 -05:00
Faye Amacker
ab84f38373
Merge pull request #671 from adeinega/p
...
Fix typos in some comments.
2025-06-14 10:22:13 -05:00
dependabot[bot]
1a69476094
Bump github/codeql-action from 3.28.19 to 3.29.0
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3.28.19 to 3.29.0.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](fca7ace96b...ce28f5bb42 )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.29.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-06-12 09:08:31 +00:00
adeinega
6d25d3f82f
Fix typos here and there.
...
Signed-off-by: Andrii Deinega andrii.deinega@gmail.com
2025-06-10 13:31:56 -07:00
Faye Amacker
3e7e03652c
Merge pull request #670 from fxamacker/fxamacker/improve-error-message
...
Improve DupMapKeyError message
2025-06-08 13:51:36 -05:00
Faye Amacker
a132c35bfe
Improve DupMapKeyError message
...
CodeQL / Analyze (go) (push) Has been cancelled
govulncheck / Check (push) Has been cancelled
This commit is only relevant for user apps that use
the non-default DupMapKeyEnforcedAPF decoding option.
Currently, DupMapKeyError uses hardcoded quotes in the
error message for map keys, including non-string types.
Given this, an error message containing a quoted integer
having a value of 1 looks the same as the string "1"
because they both have quotes in the error message.
This commit removes the hardcoded quotes in the error message
and replaces %v with %#v to only emit quotes when applicable.
2025-06-08 12:51:32 -05:00
Faye Amacker
f637d45b5c
Merge pull request #667 from fxamacker/dependabot/github_actions/github/codeql-action-3.28.19
...
Bump github/codeql-action from 3.28.18 to 3.28.19
2025-06-07 14:29:15 -05:00
dependabot[bot]
2cdcb17d0c
Bump github/codeql-action from 3.28.18 to 3.28.19
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3.28.18 to 3.28.19.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](ff0a06e83c...fca7ace96b )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.28.19
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-06-04 09:52:25 +00:00
Faye Amacker
0a60138d12
Merge pull request #664 from fxamacker/dependabot/github_actions/github/codeql-action-3.28.18
...
Bump github/codeql-action from 3.28.17 to 3.28.18
2025-05-20 07:15:15 -05:00
dependabot[bot]
cad5c27bc7
Bump github/codeql-action from 3.28.17 to 3.28.18
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3.28.17 to 3.28.18.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](60168efe1c...ff0a06e83c )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.28.18
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-05-19 09:49:42 +00:00
Faye Amacker
6d626276a0
Merge pull request #663 from fxamacker/fxamacker/refactor-to-use-reflect-funcs
...
Refactor to use reflect package functions
2025-05-18 19:14:23 -05:00
Faye Amacker
4c238c9a21
Merge pull request #662 from fxamacker/fxamacker/update-quickstart-embedded-json-tag
...
Update README for Embedded JSON Tag for CBOR (tag 262)
2025-05-18 16:52:28 -05:00
Faye Amacker
8caf8f0327
Update README for Embedded JSON Tag for CBOR
...
CodeQL / Analyze (go) (push) Has been cancelled
govulncheck / Check (push) Has been cancelled
Update the CBOR Tags section of the Quick Start to:
- mention fxamacker/cbor allows user apps to use almost any current or future CBOR tag number by implementing cbor.Marshaler and cbor.Unmarshaler interfaces.
- add example code using Embedded JSON Tag for CBOR (tag 262) and add URL to issue 657.
2025-05-18 16:21:45 -05:00
Faye Amacker
23293ce720
Replace code with reflect Value.SetZero()
...
CodeQL / Analyze (go) (push) Has been cancelled
govulncheck / Check (push) Has been cancelled
This commit replaces custom code that resets zero value for
reflect.Value with reflect pkg Value.SetZero() added in Go 1.20.
2025-05-18 15:17:41 -05:00
Faye Amacker
dce29d6706
Replace code with StructField.IsExported()
...
This commit replaces custom code checking of StructField.PkgPath with
calling StructField.IsExported() added in Go 1.17.
2025-05-18 13:53:24 -05:00
Faye Amacker
fe7bae620f
Merge pull request #661 from fxamacker/dependabot/github_actions/actions/setup-go-5.5.0
...
Bump actions/setup-go from 5.4.0 to 5.5.0
2025-05-10 08:35:59 -05:00
dependabot[bot]
a1b00ee9dc
Bump actions/setup-go from 5.4.0 to 5.5.0
...
Bumps [actions/setup-go](https://github.com/actions/setup-go ) from 5.4.0 to 5.5.0.
- [Release notes](https://github.com/actions/setup-go/releases )
- [Commits](0aaccfd150...d35c59abb0 )
---
updated-dependencies:
- dependency-name: actions/setup-go
dependency-version: 5.5.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-05-08 09:32:21 +00:00
Faye Amacker
c15166b972
Merge pull request #660 from fxamacker/dependabot/github_actions/github/codeql-action-3.28.17
...
Bump github/codeql-action from 3.28.16 to 3.28.17
2025-05-04 09:28:00 -05:00
dependabot[bot]
96cabe1120
Bump github/codeql-action from 3.28.16 to 3.28.17
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3.28.16 to 3.28.17.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](28deaeda66...60168efe1c )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.28.17
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-05-02 09:31:10 +00:00
Faye Amacker
2779884d30
Merge pull request #659 from fxamacker/fxamacker/update-comments-and-docs
...
Update docs for TimeMode, Tag, RawTag, and add example for Embedded JSON Tag for CBOR
2025-04-27 18:09:43 -05:00
Faye Amacker
92f7b97a36
Add example of Embedded JSON Tag for CBOR
...
CodeQL / Analyze (go) (push) Has been cancelled
govulncheck / Check (push) Has been cancelled
For more info, see
https://github.com/toravir/CBOR-Tag-Specs/blob/master/embeddedJSON.md
2025-04-27 17:38:27 -05:00
Faye Amacker
df7db22e3a
Improve docs for CBOR time encoding options
...
Mention that:
- time encoding options provided by cbor.TimeMode comply with RFC 8949.
- user apps that prefer to encode time in other ways (e.g. not specified by RFC 8949) can use a CBOR tag number not assigned by IANA and implement cbor.Marshal and cbor.Unmarshal interfaces.
Also, update the comments for each time encoding option to be more useful to programmers who did not read RFC 8949. The old comments were meant to be stop-gaps due to schedule.
2025-04-26 15:34:26 -05:00
Faye Amacker
b961ec4927
Update comments in tag.go
...
Clarify the comments describing cbor.Tag and cbor.RawTag.
2025-04-26 11:51:58 -05:00
Faye Amacker
b4748bf734
Merge pull request #658 from fxamacker/dependabot/github_actions/github/codeql-action-3.28.16
...
Bump github/codeql-action from 3.28.15 to 3.28.16
2025-04-26 07:41:25 -05:00
dependabot[bot]
148e522e0a
Bump github/codeql-action from 3.28.15 to 3.28.16
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3.28.15 to 3.28.16.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](45775bd823...28deaeda66 )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.28.16
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-04-24 09:44:33 +00:00
Faye Amacker
08b5ff9fc2
Merge pull request #651 from fxamacker/dependabot/github_actions/github/codeql-action-3.28.15
...
Bump github/codeql-action from 3.28.13 to 3.28.15
2025-04-13 21:57:53 -05:00
Faye Amacker
b95b6910f2
Merge pull request #655 from theory/doc-stuff
...
Fix IntDecConvertSignedOrBigInt doc comment
2025-04-13 20:41:24 -05:00
David E. Wheeler
b46b74de47
Fix IntDecConvertSignedOrBigInt doc comment
...
And mention in the `DecOptions.IntDec` docs that some IntDecMode values
will decode large values into big.Int.
2025-04-13 14:23:53 -04:00
Faye Amacker
80633d5197
Merge pull request #653 from fxamacker/fxamacker/update-readme-for-special-field-tag
...
README: Document struct field tag "-".
2025-04-13 11:55:55 -05:00
Faye Amacker
474d4b13af
README: Document struct field tag "-"
...
The field tag "-" wasn't documented in README.
This change updates the README to mention it in a few places and adds example code from:
https://github.com/fxamacker/cbor/issues/652
2025-04-13 10:06:10 -05:00
dependabot[bot]
b4a71df1b6
Bump github/codeql-action from 3.28.13 to 3.28.15
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3.28.13 to 3.28.15.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](1b549b9259...45775bd823 )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 3.28.15
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-04-08 09:12:42 +00:00
Faye Amacker
cbe7442e9e
Update docs for cbor v2.8.0 ( #649 )
...
CodeQL / Analyze (go) (push) Has been cancelled
govulncheck / Check (push) Has been cancelled
Update README.md:
- Update "Status" section.
- Replace "struct tags" with "struct tag options" when referring to options.
Update doc.go:
- Mention omitzero option (for struct tags) in more places. Also mention Diagnose, DiagnoseFirst, UnmarshalFirst, etc. added in prior releases.
- Add example using UnmarshalFirst to show support for trailing bytes (extraneous data) typically found in CBOR Sequences (RFC 8742).
- Add example using DiagnoseFirst to show support for representing binary CBOR data item in Extended Diagnostic Notation (human-readable text inspired by JSON).
- Replace "struct tags" with "struct tag options" when referring to options.
Update example_test.go
- Replace "struct tags" with "struct tag options" when referring to options.
2025-03-30 13:25:59 -05:00