You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I understand why the original proposal stated:
The inlined field must be a Go struct that does not implement Marshaler or Unmarshaler
But I'm having a hard time understanding why the string-ish behavior for map keys couldn't be applied to inline tagged maps as well.
Thank you!
The text was updated successfully, but these errors were encountered:
edkloczko
changed the title
Allow inlineing custom map key types that implement encoding.Text*arshaler
Allow inline tag on custom map key types that implement encoding.Text*arshalerAug 21, 2024
I believe we could expand the restrictions, but permitting keys to support encoding.TextMarshaler complicates duplicate key detection. It's a solvable problem, but probably not something to solve for the first stable release of this module. The benefit of restricted features is that we can generally expand it in the future, but not the other way around.
In both the standard and experimental
json
libraries, I can use a custom type that implements theencoding.TextUnmarshaler
andencoding.TextMarshaler
interfaces as map keys. When using theinline
flag, this is no longer allowed.I think I understand why the original proposal stated:
But I'm having a hard time understanding why the string-ish behavior for map keys couldn't be applied to
inline
tagged maps as well.Thank you!
The text was updated successfully, but these errors were encountered: