diff --git a/flag_bool.go b/flag_bool.go index 4a6b1f3e6e..01e53f46e0 100644 --- a/flag_bool.go +++ b/flag_bool.go @@ -46,6 +46,7 @@ func (b *boolValue) Set(s string) error { v, err := strconv.ParseBool(s) if err != nil { err = errors.New("parse error") + return err } *b.destination = v *b.count = *b.count + 1 @@ -120,7 +121,8 @@ func (f *BoolFlag) Apply(set *flag.FlagSet) error { if f.Destination != nil { value = newBoolValue(f.Value, f.Destination, &f.Count) } else { - value = newBoolValue(f.Value, &f.Value, &f.Count) + t := new(bool) + value = newBoolValue(f.Value, t, &f.Count) } set.Var(value, name, f.Usage) }