-
Notifications
You must be signed in to change notification settings - Fork 209
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
How to ignore date fields in JSON #156
Comments
Here's one possible way of doing it: https://play.golang.org/p/PKGzR3fXs-P General approach:
Hope this helps. |
Hi! Thanks very much for your help. Your snippet surely works, but when I applied it to the project, I've got:
I'm wondering if it's a version issue? |
This seems to be an issue that is beyond this project. If I could guess, you might be running in module mode, where the vendor is not being respected. I recommend fully embracing modules and avoid use of vendor. In my experience, the vendor approach has been nothing but trouble. |
Thanks again! Will work into that. best regards! |
Hi,
I'm working in a project that compares two JSONs in unit tests this way:
if diff := cmp.Diff(string(expected), string(got)); diff != "" {
fmt.Println(string(got))
t.Errorf("%s: (-want, +got)\n%s", fixturePath, diff)
}
These JSONs have datetime fields and I want to ignore those fields. I really don't want to compare them. How can I accomplish this?
the Diff() method accepts some options, right?
Best regards,
Tiago
The text was updated successfully, but these errors were encountered: