1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:14:42 -07:00

flag: fix bug in handling of booleans on error

Fixes #3869.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6448072
This commit is contained in:
Rob Pike 2012-07-27 16:13:29 -07:00
parent 88e858ac80
commit 48ca3f288c

View File

@ -707,7 +707,7 @@ func (f *FlagSet) parseOne() (bool, error) {
if fv, ok := flag.Value.(*boolValue); ok { // special case: doesn't need an arg
if has_value {
if err := fv.Set(value); err != nil {
f.failf("invalid boolean value %q for -%s: %v", value, name, err)
return false, f.failf("invalid boolean value %q for -%s: %v", value, name, err)
}
} else {
fv.Set("true")