Conversation
| } | ||
|
|
||
| func Eq[T comparable](a, b *T) bool { | ||
| func Equal[T comparable](a, b *T) bool { |
There was a problem hiding this comment.
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.
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.
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.
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.
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.