From 80fe0fb4eba54167e2ccae1c6c950e72abf61b73 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Fri, 5 May 2017 09:40:53 -0400 Subject: Testing for Shorthand Lookup --- flag.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'flag.go') 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] -- cgit v1.2.3