Skip to content

Reporter should be more aggressive about pruning output #245

Closed
@dsnet

Description

@dsnet

The following snippet hangs:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions