anyEqual reports whether two messages which may be google.protobuf.Any or may contain google.protobuf.Any fields are equal. We can't use proto.Equal for comparison, because semantically equivalent messages may be marshaled to binary in different tag order. Instead, trust that TextMarshaler with Expa
(got, want proto.Message)
| 31 | // binary in different tag order. Instead, trust that TextMarshaler with |
| 32 | // ExpandAny option works and compare the text marshaling results. |
| 33 | func anyEqual(got, want proto.Message) bool { |
| 34 | // if messages are proto.Equal, no need to marshal. |
| 35 | if proto.Equal(got, want) { |
| 36 | return true |
| 37 | } |
| 38 | g := expandedMarshaler.Text(got) |
| 39 | w := expandedMarshaler.Text(want) |
| 40 | return g == w |
| 41 | } |
| 42 | |
| 43 | type golden struct { |
| 44 | m proto.Message |
no test coverage detected