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

flag: fix format error in boolean error report. just use %q; the values are strings.

R=rsc
CC=golang-dev
https://golang.org/cl/3418043
This commit is contained in:
Rob Pike 2010-12-06 14:23:52 -05:00
parent 730e39cd13
commit e26f9b3420

View File

@ -459,7 +459,7 @@ func (f *allFlags) parseOne(index int) (ok bool, next int) {
if f, ok := flag.Value.(*boolValue); ok { // special case: doesn't need an arg if f, ok := flag.Value.(*boolValue); ok { // special case: doesn't need an arg
if has_value { if has_value {
if !f.Set(value) { if !f.Set(value) {
fmt.Fprintf(os.Stderr, "invalid boolean value %t for flag: -%s\n", value, name) fmt.Fprintf(os.Stderr, "invalid boolean value %q for flag: -%s\n", value, name)
fail() fail()
} }
} else { } else {
@ -479,7 +479,7 @@ func (f *allFlags) parseOne(index int) (ok bool, next int) {
} }
ok = flag.Value.Set(value) ok = flag.Value.Set(value)
if !ok { if !ok {
fmt.Fprintf(os.Stderr, "invalid value %s for flag: -%s\n", value, name) fmt.Fprintf(os.Stderr, "invalid value %q for flag: -%s\n", value, name)
fail() fail()
} }
} }