Copyright 2019 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package proto

import (
	
)
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.
Handle singular message.
		case .Cardinality() != protoreflect.Repeated:
			if .Message() != nil {
				(.Get().Message())
Handle list of messages.
		case .IsList():
			if .Message() != nil {
				 := .Get().List()
				for  := 0;  < .Len(); ++ {
					(.Get().Message())
				}
Handle map of messages.
		case .IsMap():
			if .MapValue().Message() != nil {
				 := .Get().Map()
				.Range(func( protoreflect.MapKey,  protoreflect.Value) bool {
					(.Message())
					return true
				})
			}
		}
		return true
	})
Discard unknown fields.
	if len(.GetUnknown()) > 0 {
		.SetUnknown(nil)
	}