Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Unmarshal godoc doesn't mention that cbor.Tag is produced for unrecognized tags when decoding into empty interface #447

Closed
benluddy opened this issue Dec 7, 2023 · 1 comment
Labels

Comments

@benluddy
Copy link
Contributor

benluddy commented Dec 7, 2023

What is the URL of the content?

cbor/decode.go

Lines 40 to 53 in 6bbaf8b

// To unmarshal CBOR into an empty interface value, Unmarshal uses the
// following rules:
//
// CBOR booleans decode to bool.
// CBOR positive integers decode to uint64.
// CBOR negative integers decode to int64 (big.Int if value overflows).
// CBOR floating points decode to float64.
// CBOR byte strings decode to []byte.
// CBOR text strings decode to string.
// CBOR arrays decode to []interface{}.
// CBOR maps decode to map[interface{}]interface{}.
// CBOR null and undefined values decode to nil.
// CBOR times (tag 0 and 1) decode to time.Time.
// CBOR bignums (tag 2 and 3) decode to big.Int.

Please describe the problem.

When decoding a tagged data item into an empty interface value, Unmarshal produces a cbor.Tag if it doesn't recognize the tag number. (https://go.dev/play/p/EkGAJ5LnKdI)

@fxamacker
Copy link
Owner

@benluddy Thanks for spotting this and opening PR #448!

Closed by #448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants