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/Unmarshal string to struct (and vice-versa) #68

Open
smoyer64 opened this issue Nov 11, 2019 · 1 comment
Open

Marshal/Unmarshal string to struct (and vice-versa) #68

smoyer64 opened this issue Nov 11, 2019 · 1 comment

Comments

@smoyer64
Copy link

String values should marshal/unmarshal to struct when MarshalText/UnmarshalText are implemented. both the encoding/json and encoding/xml packages provide this capability so it should be a matter of letting the underlying library do the encoding/decoding.

@icholy
Copy link
Collaborator

icholy commented Jul 3, 2020

Can you provide a concrete example of what that would look like? Would MarshalText return the entire value?

func (t Thing) MarshalText() ([]byte, error) {
  return []byte("<value><int>1</int></value>"), nil
}

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

No branches or pull requests

2 participants