Skip to content

Conversation

@robbkidd
Copy link

@robbkidd robbkidd commented Jan 18, 2024

Demonstrates the issue in #49 that that a default of true will override an existing value of false for bool fields.

Demonstrates that that a default of true will override an existing value
of false for bool fields.
func TestOverrideDefaultTrueBoolToFalse(t *testing.T) {
type example struct {
BoolTrue bool `default:"true"`
BoolPointerTrue *bool `default:"true"`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the workaround to have a field that defaults to true that a user can still set to false and not have defaults.Set() change it back to true.

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

Successfully merging this pull request may close these issues.

1 participant