Skip to content

fix: honor custom codecs for slices of named uint8 types - #399

Open
sonnemusk wants to merge 1 commit into
vmihailenco:v5from
sonnemusk:fix/named-byte-slice-custom-decoder
Open

fix: honor custom codecs for slices of named uint8 types#399
sonnemusk wants to merge 1 commit into
vmihailenco:v5from
sonnemusk:fix/named-byte-slice-custom-decoder

Conversation

@sonnemusk

Copy link
Copy Markdown

What

The []byte-kind shortcut no longer applies when the element type implements a custom codec (CustomEncoder/CustomDecoder, Marshaler/Unmarshaler, or binary/text marshaler interfaces).

Why

Named uint8 types with custom encode/decode were packed as raw bin blobs in slices, while scalars used the custom codec. That is inconsistent and surprising.

Plain []byte still uses binary encoding.

Fixes #391.

Test

  • TestNamedUint8SliceUsesCustomCodec

[]byte-kind shortcut no longer overrides CustomEncoder/CustomDecoder
(or Marshaler/Unmarshaler) on named uint8 element types (vmihailenco#391).
Plain []byte still uses binary 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.

[]byte-kind shortcut overrides element CustomEncoder/CustomDecoder for named uint8 slices

1 participant