Skip to content

encoder: call TextMarshaler and Stringer when encoding - #256

Open
team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:encoder-text-marshaler
Open

team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:encoder-text-marshaler

Conversation

@team-humaki

Copy link
Copy Markdown

Decode already uses encoding.TextUnmarshaler. Encode left custom types needing RegisterEncoder.

Types that implement encoding.TextMarshaler or fmt.Stringer are now encoded as a single value (TextMarshaler wins). RegisterEncoder still takes precedence. Nested structs without those interfaces are unchanged.

Fixes #196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[question] Why can't Encoder check and call fmt.Stringer.String() on element automatically?

1 participant