@@ -37,7 +37,7 @@ func (d *Differ) diffSliceGeneric(path []string, a, b reflect.Value) error {
37
37
for i := 0 ; i < a .Len (); i ++ {
38
38
ae := a .Index (i )
39
39
40
- if (d .SliceOrdering && ! hasAtSameIndex (b , ae , i )) || (! d .SliceOrdering && ! slice .has (b , ae )) {
40
+ if (d .SliceOrdering && ! hasAtSameIndex (b , ae , i )) || (! d .SliceOrdering && ! slice .has (b , ae , d )) {
41
41
missing .addA (i , & ae )
42
42
}
43
43
}
@@ -46,7 +46,7 @@ func (d *Differ) diffSliceGeneric(path []string, a, b reflect.Value) error {
46
46
for i := 0 ; i < b .Len (); i ++ {
47
47
be := b .Index (i )
48
48
49
- if (d .SliceOrdering && ! hasAtSameIndex (a , be , i )) || (! d .SliceOrdering && ! slice .has (a , be )) {
49
+ if (d .SliceOrdering && ! hasAtSameIndex (a , be , i )) || (! d .SliceOrdering && ! slice .has (a , be , d )) {
50
50
missing .addB (i , & be )
51
51
}
52
52
}
@@ -88,7 +88,7 @@ func (d *Differ) diffSliceComparative(path []string, a, b reflect.Value) error {
88
88
// keeps track of elements that have already been matched, to stop duplicate matches from occurring
89
89
type sliceTracker []bool
90
90
91
- func (st * sliceTracker ) has (s , v reflect.Value ) bool {
91
+ func (st * sliceTracker ) has (s , v reflect.Value , d * Differ ) bool {
92
92
if len (* st ) != s .Len () {
93
93
(* st ) = make ([]bool , s .Len ())
94
94
}
@@ -100,7 +100,17 @@ func (st *sliceTracker) has(s, v reflect.Value) bool {
100
100
}
101
101
102
102
x := s .Index (i )
103
- if reflect .DeepEqual (exportInterface (x ), exportInterface (v )) {
103
+
104
+ var nd Differ
105
+ nd .Filter = d .Filter
106
+ nd .customValueDiffers = d .customValueDiffers
107
+
108
+ err := nd .diff ([]string {}, x , v , nil )
109
+ if err != nil {
110
+ continue
111
+ }
112
+
113
+ if len (nd .cl ) == 0 {
104
114
(* st )[i ] = true
105
115
return true
106
116
}
0 commit comments