Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression for non-addressable structs (#16)
When we removed the default, unsafe mode, it caused a regression where we are no longer able to deserialize things like ```go map[string]struct{A string} ``` when we are deserializing into an already existing `struct` instance. This is because the `struct` in the map is not addressable by default, which caused a runtime panic. The previous unsafe version wrote directly to the underlying memory and bypassed this check We fix that by marking structs as an "immutable" type in the decoder, forcing it to recreate the `struct` rather than try to write to a non-addressable `struct`. (This was found by testing `hashicorp/nomad`, which uses `net-rpc-msgpack`, which uses this pattern of decoding two messages into one value.)
- Loading branch information