diff --git a/diff_struct.go b/diff_struct.go index 57298b5..4e7045f 100644 --- a/diff_struct.go +++ b/diff_struct.go @@ -65,6 +65,7 @@ func (d *Differ) diffStruct(path []string, a, b reflect.Value) error { func (d *Differ) structValues(t string, path []string, a reflect.Value) error { var nd Differ + nd.Filter = d.Filter if t != CREATE && t != DELETE { return ErrInvalidChangeType @@ -98,6 +99,10 @@ func (d *Differ) structValues(t string, path []string, a reflect.Value) error { fpath := copyAppend(path, tname) + if nd.Filter != nil && !nd.Filter(fpath, a.Type(), field) { + continue + } + err := nd.diff(fpath, xf, af, a.Interface()) if err != nil { return err