IgnoreFields returns an [cmp.Option] that ignores fields of the given names on a single struct type. It respects the names of exported fields that are forwarded due to struct embedding. The struct type is specified by passing in a value of that type. The name may be a dot-delimited string (e.g., "F
(typ interface{}, names ...string)
| 22 | // The name may be a dot-delimited string (e.g., "Foo.Bar") to ignore a |
| 23 | // specific sub-field that is embedded or nested within the parent struct. |
| 24 | func IgnoreFields(typ interface{}, names ...string) cmp.Option { |
| 25 | sf := newStructFilter(typ, names...) |
| 26 | return cmp.FilterPath(sf.filter, cmp.Ignore()) |
| 27 | } |
| 28 | |
| 29 | // IgnoreTypes returns an [cmp.Option] that ignores all values assignable to |
| 30 | // certain types, which are specified by passing in a value of each type. |