Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reflect.DeepEqual varient that returns an error describing the inequality #39652

Closed
sjpotter opened this issue Jun 17, 2020 · 1 comment
Closed

Comments

@sjpotter
Copy link

currently, DeepEqual is just a bool that returns true/false if things are equal or not. However, as has been seen in the past via Qs (ex "while is an empty map and a nil map not equal according to DeepEquall") as well as that it can be difficult to understand deeply nested structures for why they are not equal. It be useful (at least during development) to have a varient that returned the reason for DeepEqual returning false.

The primary reason I can see for not wanting to do it is that since it be more expensive, you would probably want to do it as a separate implementation from DeepEqual which would involve code duplication and if one doesn't view it gaining them a lot.

@andybons
Copy link
Member

I believe a package like https://github.com/google/go-cmp is better suited for this use case.

Closing for now, but feel free to comment if you’d like to re-open.

@golang golang locked and limited conversation to collaborators Jun 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants