Skip to content

Fix struct encoding issues#66

Open
kenbell wants to merge 2 commits intobrutella:masterfrom
kenbell:master
Open

Fix struct encoding issues#66
kenbell wants to merge 2 commits intobrutella:masterfrom
kenbell:master

Conversation

@kenbell
Copy link

@kenbell kenbell commented Feb 20, 2026

Before this change:

1 - Marking a struct field as 'optional' would result in an invalid TLV8 object on encoding, with the tag value set to zero.
2 - A nil field in the encoding structure caused a panic, instead of skipping the field.

To fix these:

1 - The parsing logic from decoder.go was copied to separate tag value from the flag 'optional'.
2 - An IsZero check is added on field values (signifying nil/default value) and so skipped from encoding.

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