aboutsummaryrefslogtreecommitdiff
path: root/flag.go
diff options
context:
space:
mode:
authorEric Paris <[email protected]>2017-05-05 09:40:53 -0400
committerAlbert Nigmatzianov <[email protected]>2017-05-05 16:36:56 +0200
commit80fe0fb4eba54167e2ccae1c6c950e72abf61b73 (patch)
tree43848e259c223b1891f60613f48a1cb29398b128 /flag.go
parent75859d1ee5f135362c9534f7db667e0150d9f577 (diff)
Testing for Shorthand Lookup
Diffstat (limited to 'flag.go')
-rw-r--r--flag.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/flag.go b/flag.go
index 0519465..6f1fc30 100644
--- a/flag.go
+++ b/flag.go
@@ -327,7 +327,9 @@ func (f *FlagSet) ShorthandLookup(name string) *Flag {
return nil
}
if len(name) > 1 {
- panic("can't look up for a shorthand with name more than one character")
+ msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name)
+ fmt.Fprintf(f.out(), msg)
+ panic(msg)
}
c := name[0]
return f.shorthands[c]