-
Notifications
You must be signed in to change notification settings - Fork 158
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
Panic when private fields differ #21
Comments
Thanks for the report, especially the simple code to reproduce. I'll see if I can take a look at this, unless you have started on a fix already? |
I don't have a fix, but my suggestion would probably be to call out the field that differs but not compute the diff itself when the field is private. |
I looked into this last night, but I had some degree of trouble deciphering the output from Your suggestion makes some sense, but it doesn't really address the use case of someone trying to determine how the values are actually different. I think that limits its utility (granted, it's better than a panic!). I don't have more time in my schedule to look at it this week, unfortunately. If I had the time, I would start by updating the tests to cover your case (use a struct that has typed private fields, not just interface{} fields, including some as pointers) and also consider updating the test helpers to make it easier to decipher the failure messages. With that, the changes in diff.go should be fairly straightforward.
|
Executing the following code:
Panics with the message:
I realize it may not be possible to actually produce the diff on private fields, but I doubt that a panic is what's intended.
The text was updated successfully, but these errors were encountered: