You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Diff returns a human-readable report of the differences between two values:
// y - x. ...
func Diff(x, y interface{}, opts ...Option)
Is there a way to ignore things added iny in the output? I realize I could post process the diff output and drop lines with + but without the preceeding - but wondering if there's a better way.
The text was updated successfully, but these errors were encountered:
Not really. The behavior of cmp.Diff is to be symmetric such that the result of cmp.Equal(x, y) and cmp.Equal(y, x) are identical.
Functionally ignoring insertions implies an assymetric comparison, which is not something this package supports. Doing so would need to carefully think through the implications and how an asymmetric comparison would interact with existing cmp.Options that assume symmetric properties of equality.
From https://github.com/google/go-cmp/blob/v0.5.9/cmp/compare.go#L113
Is there a way to ignore things added in
y
in the output? I realize I could post process the diff output and drop lines with+
but without the preceeding-
but wondering if there's a better way.The text was updated successfully, but these errors were encountered: