Open amanenk opened 2 years ago
Hey @amanenk,
Sorry for the delay in getting back to you and thanks for raising the issue!
This is a bit of a tricky one...
When diffing two slices with SliceOrdering
set to false
, we:
a
and check if it has an exact match in slice b
b
and check if it has an exact match in slice a
Step 4
in this case is why changing the order of the slices in your example produces different results.
This works well for simple values like int
or string
where comparisons are binary; values match or they don't.
With more complicated values like map
s, it's possible to update one of many values in the map. At this point it's ambiguous as to which maps in each slice are equivalent.
It might be possible to try to find the best possible partial match in each slice, but I'm not confident that would actually produce more reliable results.
I am trying to compare slice of maps but the results are inconsistent. As I understand correctly the code below should show the same result for a == b and a == c
That would be awesome to ad an option that allows to have consistent results in this case