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

IgnoreFields and nested struct #346

Closed
kotyara85 opened this issue Dec 16, 2023 · 2 comments
Closed

IgnoreFields and nested struct #346

kotyara85 opened this issue Dec 16, 2023 · 2 comments

Comments

@kotyara85
Copy link

Hey there,
So I have this struct

type File struct {
Sources []*Source `json:"sources"`
}


type Source struct {
 UID string `json:"uid"
}

I need to ignore UID as it's dynamically generated

cmp.Equal(c.response, response, cmpopts.IgnoreFields(File{}, "UID"))

Is not doing anything. Is there a way to achieve this with this package?

Thanks!

@dsnet
Copy link
Collaborator

dsnet commented Dec 19, 2023

Don't you mean cmpopts.IgnoreFields(Source, "UID)? as the "UID" field is declared on the Source type rather than the File type?

@dsnet
Copy link
Collaborator

dsnet commented Jan 12, 2024

Closing as there is nothing actionable here. Feel free to comment with an update and we can reopen.

@dsnet dsnet closed this as completed Jan 12, 2024
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

No branches or pull requests

2 participants