MCPcopy
hub / github.com/google/go-cmp / IgnoreInterfaces

Function IgnoreInterfaces

cmp/cmpopts/ignore.go:66–69  ·  view source on GitHub ↗

IgnoreInterfaces returns an [cmp.Option] that ignores all values or references of values assignable to certain interface types. These interfaces are specified by passing in an anonymous struct with the interface types embedded in it. For example, to ignore [sync.Locker], pass in struct{sync.Locker}{

(ifaces interface{})

Source from the content-addressed store, hash-verified

64// by passing in an anonymous struct with the interface types embedded in it.
65// For example, to ignore [sync.Locker], pass in struct{sync.Locker}{}.
66func IgnoreInterfaces(ifaces interface{}) cmp.Option {
67 tf := newIfaceFilter(ifaces)
68 return cmp.FilterPath(tf.filter, cmp.Ignore())
69}
70
71type ifaceFilter []reflect.Type
72

Callers 2

project3TestsFunction · 0.92
TestOptionsFunction · 0.85

Calls 3

FilterPathFunction · 0.92
IgnoreFunction · 0.92
newIfaceFilterFunction · 0.85

Tested by 2

project3TestsFunction · 0.74
TestOptionsFunction · 0.68