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
The documentation should say more explicitly how it handles exported and unexported struct fields.
Current Behavior
The documentation doesn't say much about this (unless I missed the relevant section).
Possible Solution
The documentation would say upfront something like "Due to how visibility rules work in Go, the package msgpack will not access any of your struct's unexported fields (starting with a lowercase) even if they have a proper msgpack struct field tag. To make your field serializable/deserializable, make the fields public (or implement MarshalMsgpack and UnmarshalMsgpack). By default a public field results in a msgpack field name starting with an uppercase, but this can be avoided with a struct field tag. All of this is similar to how the standard library package json works."
The text was updated successfully, but these errors were encountered:
Expected Behavior
The documentation should say more explicitly how it handles exported and unexported struct fields.
Current Behavior
The documentation doesn't say much about this (unless I missed the relevant section).
Possible Solution
The documentation would say upfront something like "Due to how visibility rules work in Go, the package
msgpack
will not access any of your struct's unexported fields (starting with a lowercase) even if they have a proper msgpack struct field tag. To make your field serializable/deserializable, make the fields public (or implementMarshalMsgpack
andUnmarshalMsgpack
). By default a public field results in a msgpack field name starting with an uppercase, but this can be avoided with a struct field tag. All of this is similar to how the standard library packagejson
works."The text was updated successfully, but these errors were encountered: