You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've implemented a custom Value type for managing generic data. Everything works as it should, but the flags always show a default in their usage string regardless of whether they have a zero value:
The issue seems to be caused here - by checking for whether the value implements the boolFlag interface (rather than the return value of IsBoolFlag()):
The defaultIsZeroValue() method was erroneously assuming that all types that implement IsBoolFlag() were bools - regardless of the return value of IsBoolFlag().
Fixesspf13#360
I've implemented a custom
Value
type for managing generic data. Everything works as it should, but the flags always show a default in their usage string regardless of whether they have a zero value:The issue seems to be caused here - by checking for whether the value implements the boolFlag interface (rather than the return value of
IsBoolFlag()
):pflag/flag.go
Lines 536 to 541 in d5e0c06
Seems like the fix would be to move the boolFlag check prior to the switch statement and have it actually call
IsBoolFlag()
, like so:Then custom values would make it through to the default case in the switch statement.
The text was updated successfully, but these errors were encountered: