Skip to content

Conversation

lmb
Copy link
Contributor

@lmb lmb commented Apr 3, 2023

Using Not(DeepEquals) on a type with an unexported field currently succeeds without an error. This is because the unexported field is raised as a panic by go-cmp, which is turned into a plain error by the library. Not then interprets the error to mean "not equal" instead of forwarding it to the user.

Fix this by turning any go-cmp panics into a bad check.

Fixes #153

Using Not(DeepEquals) on a type with an unexported field currently
succeeds without an error. This is because the unexported field is
raised as a panic by go-cmp, which is turned into a plain error by
the library. Not then interprets the error to mean "not equal" instead
of forwarding it to the user.

Fix this by turning any go-cmp panics into a bad check.

Fixes frankban#153
Copy link
Owner

@frankban frankban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks!

@frankban frankban merged commit 9a0c242 into frankban:master Apr 11, 2023
@lmb lmb deleted the cmp-equal-bad-checkf branch April 12, 2023 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not(DeepEquals) succeeds even though go-cmp panicked
2 participants