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

The handling of nil byte slices is different than the handling of other types of nil slices #27

Closed
aboodman opened this issue May 24, 2018 · 2 comments

Comments

@aboodman
Copy link
Contributor

type T struct{}
var t1, t2 []T
data, _ = cbor.Marshal(t1)
cbor.Unmarshal(data, &t2)
assert.Nil(t1)  // true
assert.Nil(t2)  // true

var b1, b2 []byte
data, _ := cbor.Marshal(b1)
cbor.Unmarshal(data, &b2)
assert.Nil(b1) // true
assert.Nil(b2) // false
@aboodman
Copy link
Contributor Author

Note: I actually prefer what it's doing for byte slices for my use case, or alternately making it optional as suggested in #25.

@warpfork
Copy link
Member

warpfork commented Oct 4, 2018

Was fixed by merging #28 (a while ago).

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

No branches or pull requests

2 participants