protobuf
protobuf copied to clipboard
internal: make MessageState truly opaque
The MessageState
type, which is nested in every generated message has a pointer to the MessageInfo
, which itself has a reference to the message descriptor for that message. Thus, deeply printing a protobuf message often results in a rediculously large amount of text being printed, most of which is just the type information for that message rather than the message value itself. We could "fix" this by making MessageState.atomicMessageInfo
an unsafe.Pointer
instead of a *MessageInfo
so that Go reflection cannot introspect upon this field.
Related to https://github.com/google/go-cmp/issues/264, but also any application that tries to deeply print protobuf messages.
\cc @neild