-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fields without a tag can still change #7
Comments
Sorry, this issue was buried in on a ton of others, the library should only affect fields with the tag. So yes feel free to do a PR. |
Do you still want to maintain compat with <go1.7? Cleanest impl uses a method added then. |
It's ok to upgrade to 1.8 or 1.9 |
There are several tests which expected the old behavior. There are a few categories:
I could maintain more of the current behaviors. I could make it so that if Filler.Tag == "", then filler functions all get called regardless of tags, effectively reverting to the old behavior. And I would change the factory filler to make Tag == "". That would make most of the tests pass again without altering their assumptions, and would make the factory filler backward compatible. |
Hi guys, It's still an issue :( Do you have a workaround for this? |
Sorry, we ending up using a different library for this (creasty/defaults) |
Example:
The
B
field starts out nil, but will be set to an empty byte slice, even though that field has no "default" tag.Looking at the code, I'm thinking either
setDefaultValues
should check for the presence of the tag, and skip the field if not present, orsetDefaultValue
should check the presence of the tag (after the zero value check).Alternatively, if this was the intended behavior, then perhaps add a default:"-" option to explicitly skip the field? Or a flag in the Filler struct to toggle the behavior? I'd be happy to do a PR.
The text was updated successfully, but these errors were encountered: