-
Notifications
You must be signed in to change notification settings - Fork 2
pointers: rename Eq() to Equal() #83
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
| } | ||
|
|
||
| func Eq[T comparable](a, b *T) bool { | ||
| func Equal[T comparable](a, b *T) bool { |
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.
what would you think of adding smth like:
if aa, ok := a.(interface{ Equal(b T) bool }); ok {
return aa.Equal(*b)
}
before the final return?
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.
This doesn't compile for me:
pointers/ptr.go:35:15: invalid operation: a (variable of type *T) is not an interface
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.
this is a bummer :(. tho i do have a dirty trick for you. you can add a var v any = a and do the type assertion on v.
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.
Ah yes, thank you
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.
your syntax is much better 👍🏼
can i ask you to add a test to assert this? you could use some *time.Time for example
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.
Sure
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.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
What does this PR do?
https://github.com/upfluence/ecommerce-server/pull/309#discussion_r2651213243
What are the observable changes?
Good PR checklist
Additional Notes
Note
Rename and enhance equality helper
Eq[T]toEqual[T]across code and testsEqualnow defers to a type’s ownEqual(b T) boolmethod when implemented (via interface check), otherwise falls back to*a == *btime.Timecomparisons across zonesWritten by Cursor Bugbot for commit 5c6663e. This will update automatically on new commits. Configure here.