Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CompareOptsForProtos = []cmp.Option{cmpopts.IgnoreTypes( protoimpl.MessageState{}, protoimpl.SizeCache(0), protoimpl.UnknownFields{}, ), cmpopts.EquateEmpty(), }
compareOptsForProtos is a slice of options for the https://github.com/google/go-cmp/cmp object comparing package. As of the latest implementation of the protocompiler for go, the messages compile to something like:
type YourMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Your fields here }
Comparisons on the private fields often/always fail (this seems intentional on the part of the protobuf devs). Excluding these types from comparison allows us to do deep equality tests on just the public fields we defined and skip internal proto stuff.
We also use cmpopts.EquateEmpty, which makes a nil map and an empty one equal, because the other packages we have been using for deep equality comparisons behave this way.
Functions ¶
func FormatUnequalValues ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.