-
Notifications
You must be signed in to change notification settings - Fork 221
Closed
Labels
Description
mx := &descriptorpb.FileDescriptorProto{Name: proto.String("descriptor.proto")}
my := &descriptorpb.FileDescriptorProto{Name: proto.String("descriptor.proto")}
x := map[*descriptorpb.FileDescriptorProto]int{mx: 1}
y := map[*descriptorpb.FileDescriptorProto]int{my: 1}
cmp.Diff(x, y)
These two objects are inequal since map keys use == and not a recursive application of cmp.Equal. It hangs because cmp.Diff is trying to format the raw data structure for a descriptorpb.FileDescriptorProto. Since descriptorpb.FileDescriptorProto has a pointer to the protobuf type information, which itself closes over the transitive set of reachable protobuf types, this is a massive data structure. The reporter logic should be more aggressive about pruning the formatted value.