Skip to content

Conversation

@m940867
Copy link
Contributor

@m940867 m940867 commented Dec 29, 2025

What does this PR do?

https://github.com/upfluence/ecommerce-server/pull/309#discussion_r2651213243

What are the observable changes?

Good PR checklist

  • Title makes sense
  • Is against the correct branch
  • Only addresses one issue
  • Properly assigned
  • Added/updated tests
  • Added/updated documentation
  • Properly labeled

Additional Notes


Note

Rename and enhance equality helper

  • Renames Eq[T] to Equal[T] across code and tests
  • Equal now defers to a type’s own Equal(b T) bool method when implemented (via interface check), otherwise falls back to *a == *b
  • Tests updated to cover renamed API and new behavior, including time.Time comparisons across zones

Written by Cursor Bugbot for commit 5c6663e. This will update automatically on new commits. Configure here.

@m940867 m940867 requested a review from a team as a code owner December 29, 2025 15:50
@m940867 m940867 requested review from pauloestrella1994 and xgoffin and removed request for a team December 29, 2025 15:50
}

func Eq[T comparable](a, b *T) bool {
func Equal[T comparable](a, b *T) bool {
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, thank you

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link

@cursor cursor bot left a 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.

@m940867 m940867 merged commit 1db0759 into master Dec 31, 2025
4 of 5 checks passed
@m940867 m940867 deleted the pointers/eq branch December 31, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants