Skip to content

"ignore struct length" flag#382

Open
Ponywka wants to merge 1 commit intovmihailenco:v5from
Ponywka:feature/ignore-struct-length-flag
Open

"ignore struct length" flag#382
Ponywka wants to merge 1 commit intovmihailenco:v5from
Ponywka:feature/ignore-struct-length-flag

Conversation

@Ponywka
Copy link

@Ponywka Ponywka commented Feb 4, 2026

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/msgpack module 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.

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

Successfully merging this pull request may close these issues.

1 participant