"ignore struct length" flag - #72
Conversation
|
Thanks for porting this from upstream — the core change is small, correct, and the trailing
Once those are addressed I'll run the post-implementation review pass and we can get this merged. Thanks again! |
|
Hi @Ponywka — following up on this one. The four items from my review above are still open, and while re-reviewing I found two more things worth addressing. Full list so you have everything in one place: From the original review (still outstanding):
New findings:
The feature itself is well-motivated and I want to land it. If you're short on time, say the word and I'll finish these off on top of your commit with authorship credit preserved — no problem either way. |
(Ported from vmihailenco#382 by vmihailenco#382 (comment) request)
In some scenarios, it is necessary to ignore the structure length.
One such example is Tarantool. Due to the specifics of the Lua language, a structure that has an empty value at the end (for example,
{0, nil, 1, 2, nil}) is truncated to the last non-nil value and becomes{0, nil, 1, 2}.More details are available in the Tarantool documentation.
Despite this behavior, the official Go module github.com/tarantool/go-tarantool/v2 still uses the
github.com/vmihailenco/msgpackmodule in the decoder (see here), which reports an error in such cases:msgpack: number of fields in array-encoded struct has changed.This PR introduces an option to ignore this error and also fixes decoding when the number of fields differs from what is defined in the struct.