how to set `nil` as default value in `BoolVar`?
OpenWaygate opened this issue · 1 comments
OpenWaygate commented
I want to keep a variable as nil except explicitly set, but only true
or false
is allowed.
myCmd.Flags().BoolVar(&isMine, "isMine", nil, "")
marckhouzam commented
In Go a bool cannot be nil but only true or false. If you’re thinking of the pointer you’re passing in, that cannot be nil as it must represent a location where cobra can write true or false