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

NotSame should fail if args are not pointers #1661

Open
brackendawson opened this issue Oct 16, 2024 Discussed in #1660 · 4 comments · May be fixed by #1664
Open

NotSame should fail if args are not pointers #1661

brackendawson opened this issue Oct 16, 2024 Discussed in #1660 · 4 comments · May be fixed by #1664
Assignees

Comments

@brackendawson
Copy link
Collaborator

Discussed in #1660

Originally posted by n4nn31355 October 16, 2024
It's confusing and error-prone that NotSame checks nothing if any of the values is not a pointer.
Is there a reason for this, or may we consider it a bug that needs an issue?

a := struct{ byte }{}
require.NotSame(t, a, a)   // Doesn't fail
require.NotSame(t, &a, &a) // Fails
```</div>
@brackendawson
Copy link
Collaborator Author

This is a simple bug, the signature of samePointers needs to be changed to:

func samePointers(first, second interface{}) (same bool, ok bool)

@sikehish
Copy link

I'd love to take this up. Could you assign this to me?

@sikehish
Copy link

sikehish commented Oct 17, 2024

I'd love to take this up. Could you assign this to me?

Thank you. Im looking into the issue.

@sikehish sikehish linked a pull request Oct 17, 2024 that will close this issue
@sikehish
Copy link

Hi @brackendawson ,
I've raised a PR #1664 , do let me know if any changes need to be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants