Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marshal: support encoding.TextMarshaler #373

Closed
oncilla opened this issue Apr 25, 2020 · 1 comment · Fixed by #374
Closed

marshal: support encoding.TextMarshaler #373

oncilla opened this issue Apr 25, 2020 · 1 comment · Fixed by #374
Labels
feature Issue asking for a new feature in go-toml.

Comments

@oncilla
Copy link
Contributor

oncilla commented Apr 25, 2020

Most go libraries that handle marshaling/unmarshaling support encoding.TextMarshaler when marshaling.

Similar to how types that implement the toml.Marshaler interface, I would like types that implement
the encoding.TextMarshaler to be supported.
If a type implements both encoding.TextMarshaler and toml.Marshaler. The MarshalToml method should take precedence.

If that is a feature you want to integrate, I would be happy to implement it.

@pelletier
Copy link
Owner

I think it’s a great idea! Thanks for calling it out. :)

@pelletier pelletier added the feature Issue asking for a new feature in go-toml. label Apr 25, 2020
oncilla added a commit to oncilla/go-toml that referenced this issue Apr 25, 2020
With this PR the encoder now supports encoding.TextMarshaler.
Additionally, a bug is fixed, where the encoder does not notice a pointer
field that implements the toml.Marshaler interface.

fixes pelletier#373
pelletier pushed a commit that referenced this issue Apr 28, 2020
With this PR the encoder now supports encoding.TextMarshaler.
Additionally, a bug is fixed, where the encoder does not notice a pointer
field that implements the toml.Marshaler interface.

fixes #373
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue asking for a new feature in go-toml.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants