From 30f7e99b82e30299f499c1aa13638dd937e075f3 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Sat, 15 Aug 2015 13:53:10 -0400 Subject: Use Type() instead of internal .(*stringValue) This makes things easier to read/understand and it also means that users who declare their own flags and call them "string" will get quotes as well. --- flag.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'flag.go') diff --git a/flag.go b/flag.go index 81b3c1f..c99ccf3 100644 --- a/flag.go +++ b/flag.go @@ -387,7 +387,7 @@ func (f *FlagSet) FlagUsages() string { if len(flag.NoOptDefVal) > 0 { format = format + "[" } - if _, ok := flag.Value.(*stringValue); ok { + if flag.Value.Type() == "string" { // put quotes on the value format = format + "=%q" } else { -- cgit v1.2.3