type generatedDiscarder … // DiscardUnknown recursively discards all unknown fields from this message // and all embedded messages. // // When unmarshaling a message with unrecognized fields, the tags and values // of such fields are preserved in the Message. This allows a later call to // marshal to be able to produce a message that continues to have those // unrecognized fields. To avoid this, DiscardUnknown is used to // explicitly clear the unknown fields after unmarshaling. // // For proto2 messages, the unknown fields of message extensions are only // discarded from messages that have been accessed via GetExtension. func DiscardUnknown(m Message) { … } // DiscardUnknown recursively discards all unknown fields. func (a *InternalMessageInfo) DiscardUnknown(m Message) { … } type discardInfo … type discardFieldInfo … var discardInfoMap … var discardInfoLock … func getDiscardInfo(t reflect.Type) *discardInfo { … } func (di *discardInfo) discard(src pointer) { … } func (di *discardInfo) computeDiscardInfo() { … } func discardLegacy(m Message) { … }