Skip to content

"ignore struct length" flag#382

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

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

Conversation

@Ponywka
Copy link
Copy Markdown

@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.

@xe-nvdk
Copy link
Copy Markdown

xe-nvdk commented Apr 14, 2026

Hi @Ponywka, this looks useful for Tarantool compatibility. This repo has been unmaintained for ~3 years so PRs have been sitting without review.

We maintain an active fork at github.com/Basekick-Labs/msgpack (v6) that's a drop-in replacement. We don't have this flag yet but it's a reasonable addition — if you're interested, we'd welcome a PR to the fork. Happy to review.

@Ponywka
Copy link
Copy Markdown
Author

Ponywka commented Apr 14, 2026

@xe-nvdk

We maintain an active fork at github.com/Basekick-Labs/msgpack (v6) that's a drop-in replacement. We don't have this flag yet but it's a reasonable addition — if you're interested, we'd welcome a PR to the fork. Happy to review.

I will do it later when I get off work

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.

2 participants