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

Function IgnoreUnexported

cmp/cmpopts/ignore.go:119–122  ·  view source on GitHub ↗

IgnoreUnexported returns an [cmp.Option] that only ignores the immediate unexported fields of a struct, including anonymous fields of unexported types. In particular, unexported fields within the struct's exported fields of struct types, including anonymous fields, will not be ignored unless the typ

(typs ...interface{})

Source from the content-addressed store, hash-verified

117// type from another repository), as changes to the implementation of such types
118// may change how the comparison behaves. Prefer a custom [cmp.Comparer] instead.
119func IgnoreUnexported(typs ...interface{}) cmp.Option {
120 ux := newUnexportedFilter(typs...)
121 return cmp.FilterPath(ux.filter, cmp.Ignore())
122}
123
124type unexportedFilter struct{ m map[reflect.Type]bool }
125

Callers 3

embeddedTestsFunction · 0.92
project1TestsFunction · 0.92
TestOptionsFunction · 0.85

Calls 3

FilterPathFunction · 0.92
IgnoreFunction · 0.92
newUnexportedFilterFunction · 0.85

Tested by 3

embeddedTestsFunction · 0.74
project1TestsFunction · 0.74
TestOptionsFunction · 0.68