-
Notifications
You must be signed in to change notification settings - Fork 88
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
option for ignoring unexported fields #89
Comments
well... I just realized I can use the diff.Filter(
func(path []string, parent reflect.Type, field reflect.StructField) bool {
return field.IsExported()
},
) hmm... I guess that's the way to handle it, right? wdyt? |
Hey @aexvir , thanks for raising the issue! So there are a couple of ways to handle this:
So 2 would be the best way to go if you have control over how those structs are defined: type MyStruct struct {
DontDiff string `diff:"-"` // this will be ignored
Diff string // will be diffed
} I hope that helps! |
while I was aware of the I still think that maybe documenting this would be nice, as it didn't struck me as something obvious on the first place and thanks for the help! |
👋🏻 hey there
I'm using this library as it has been the most consistent way to compare structs that I've found so far, thanks!
one feature that I'm missing is the option to ignore unexported fields from being compared and marked as differences, I know I can strip them by marshal/unmarshal but if that functionality would be provided by the library itself that would be amazing 🙂
I'm ok with implementing it myself and submitting a pr!
I would like to know
I haven't checked the codebase yet, that's why I'm asking this 😅
The text was updated successfully, but these errors were encountered: