mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-29 18:32:46 +00:00
testing/protocmp: document behavior when combining Ignore and Sort
fixes golang/protobuf#1652 Change-Id: I19af3714ec9fd9e54446bb0c3bd6815d90f11e10 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/622575 Reviewed-by: Christian Höppner <hoeppi@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Stapelberg <stapelberg@google.com>
This commit is contained in:
parent
d14ebce888
commit
0517e5afc7
@ -524,6 +524,9 @@ func IgnoreUnknown() cmp.Option {
|
||||
// handled by this option. To sort Go slices that are not repeated fields,
|
||||
// consider using [github.com/google/go-cmp/cmp/cmpopts.SortSlices] instead.
|
||||
//
|
||||
// The sorting of messages does not take into account ignored fields or oneofs
|
||||
// as a result of [IgnoreFields] or [IgnoreOneofs].
|
||||
//
|
||||
// This must be used in conjunction with [Transform].
|
||||
func SortRepeated(lessFunc any) cmp.Option {
|
||||
t, ok := checkTTBFunc(lessFunc)
|
||||
@ -624,6 +627,9 @@ func checkTTBFunc(lessFunc any) (reflect.Type, bool) {
|
||||
// ... // user-provided definition for less
|
||||
// }))
|
||||
//
|
||||
// The sorting of messages does not take into account ignored fields or oneofs
|
||||
// as a result of [IgnoreFields] or [IgnoreOneofs].
|
||||
//
|
||||
// This must be used in conjunction with [Transform].
|
||||
func SortRepeatedFields(message proto.Message, names ...protoreflect.Name) cmp.Option {
|
||||
var opts cmp.Options
|
||||
|
Loading…
x
Reference in New Issue
Block a user