-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Example:
type Widget struct {
B []bytes
}
defaults.SetDefaults(&Widget{})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, or setDefaultValue 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.
abemedia
Metadata
Metadata
Assignees
Labels
No labels