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{})
| 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. |
| 119 | func IgnoreUnexported(typs ...interface{}) cmp.Option { |
| 120 | ux := newUnexportedFilter(typs...) |
| 121 | return cmp.FilterPath(ux.filter, cmp.Ignore()) |
| 122 | } |
| 123 | |
| 124 | type unexportedFilter struct{ m map[reflect.Type]bool } |
| 125 |