-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore: Replace reflect.DeepEqual with cmp.Equal in tests #3691
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
Conversation
Updated multiple test files to use github.com/google/go-cmp/cmp.Equal instead of reflect.DeepEqual for value comparisons. This improves test output readability and consistency across the codebase.
@jferri - just FYI - I lost write access to this repo and this may cause unexpected delays for which I apologize. |
No worries! 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose configuring the forbidigo linter in the golangci-lint config to forbid the use of reflect.DeepEqual
in tests. This way, the use of cmp.Equal
will be automatically enforced in the future.
Configured the forbidigo linter in .golangci.yml to forbid the use of reflect.DeepEqual, recommending cmp.Equal instead. This helps ensure more reliable equality checks in the codebase.
Thanks for the suggestion, good catch 😃 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3691 +/- ##
=======================================
Coverage 91.12% 91.12%
=======================================
Files 187 187
Lines 16640 16640
=======================================
Hits 15164 15164
Misses 1291 1291
Partials 185 185 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @jferrl and @alexandear!
LGTM.
Merging.
This PR refactors the test suite to replace all instances of
reflect.DeepEqual
withcmp.Equal
from thegithub.com/google/go-cmp/cmp
package. This change improves test performance, provides better error messages, and follows modern Go testing best practices. Also improves test output readability and consistency across the codebase