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

Impossible to just compare public elements of a struct. #1033

Closed
rsheasby opened this issue Dec 21, 2020 · 2 comments · Fixed by #1309
Closed

Impossible to just compare public elements of a struct. #1033

rsheasby opened this issue Dec 21, 2020 · 2 comments · Fixed by #1309

Comments

@rsheasby
Copy link

Hi there. Firstly, thanks for the great library. I've only run into one gripe so far.

There doesn't seem to be a way to compare only the public fields of a struct. For some reason assert.Equal compares private fields too. Why do I need this? To compare protobuf messages. The public fields are the actual valuable info, and the private fields are implementation details like "sizeCache" which are unimportant but still frequently different.

@chuckoy
Copy link

chuckoy commented Jan 13, 2021

Agreed. Python's equivalent of mock.Anything (mock.ANY) also works for equality comparisons. However, I'm not saying that just because it works that way in Python it should also be the same here. That aside, there's already an existing discussion here: #758

@mchlp
Copy link
Contributor

mchlp commented Nov 28, 2022

Working on this!

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

Successfully merging a pull request may close this issue.

3 participants