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

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

sjpotter opened this issue Jun 17, 2020 · 1 comment

Comments

@sjpotter
Copy link

@sjpotter sjpotter commented Jun 17, 2020

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

@andybons andybons commented Jun 17, 2020

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.

@andybons andybons closed this Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.