// Equal returns whether two proto.Message instances are equal using the following criteria: // // - Messages must share the same instance of the type descriptor // - Known set fields are compared using semantics equality // - Bytes are compared using bytes.Equal // - Scalar values are compared with operator == // - List and map types are equal if they have the same length and all elements are equal // - Messages are equal if they share the same descriptor and all set fields are equal // - Unknown fields are compared using byte equality // - NaN values are not equal to each other // - google.protobuf.Any values are unpacked before comparison // - If the type descriptor for a protobuf.Any cannot be found, byte equality is used rather than // semantic equality. // // This method of proto equality mirrors the behavior of the C++ protobuf MessageDifferencer // whereas the golang proto.Equal implementation mirrors the Java protobuf equals() methods // behaviors which needed to treat NaN values as equal due to Java semantics. func Equal(x, y proto.Message) bool { … } func equalMessage(mx, my protoreflect.Message) bool { … } func equalField(fd protoreflect.FieldDescriptor, x, y protoreflect.Value) bool { … } func equalMap(fd protoreflect.FieldDescriptor, x, y protoreflect.Map) bool { … } func equalList(fd protoreflect.FieldDescriptor, x, y protoreflect.List) bool { … } func equalValue(fd protoreflect.FieldDescriptor, x, y protoreflect.Value) bool { … } func equalUnknown(x, y protoreflect.RawFields) bool { … } func isAny(m protoreflect.Message) bool { … }