The CBOR library is smart and will try to serialize arbitrary types using reflection. Unfortunately, this makes it very easy to introduce silent bugs.
For example, the following does not panic. Instead, cbor just uses reflection to serialize child.
child, _ := WrapObject("thing")
parent, err := WrapObject(map[string]interface{}{
"child": child, // missing a call to `.Cid()`
})
if err != nil {
panic(err)
}
The CBOR library is smart and will try to serialize arbitrary types using reflection. Unfortunately, this makes it very easy to introduce silent bugs.
For example, the following does not panic. Instead, cbor just uses reflection to serialize
child.