simplify code - eliminate type assertions
"gosimple" linter says: S1034: assigning the result of this type assertion to a variable (switch f := f.(type)) could eliminate the following type assertions: flag.go:267:26 flag.go:270:28 flag.go:273:30 flag.go:276:29
This commit is contained in:
parent
a56a0b93c8
commit
62597fe929
10
flag.go
10
flag.go
@ -261,19 +261,19 @@ func flagValue(f Flag) reflect.Value {
|
||||
func stringifyFlag(f Flag) string {
|
||||
fv := flagValue(f)
|
||||
|
||||
switch f.(type) {
|
||||
switch f := f.(type) {
|
||||
case *IntSliceFlag:
|
||||
return withEnvHint(flagStringSliceField(f, "EnvVars"),
|
||||
stringifyIntSliceFlag(f.(*IntSliceFlag)))
|
||||
stringifyIntSliceFlag(f))
|
||||
case *Int64SliceFlag:
|
||||
return withEnvHint(flagStringSliceField(f, "EnvVars"),
|
||||
stringifyInt64SliceFlag(f.(*Int64SliceFlag)))
|
||||
stringifyInt64SliceFlag(f))
|
||||
case *Float64SliceFlag:
|
||||
return withEnvHint(flagStringSliceField(f, "EnvVars"),
|
||||
stringifyFloat64SliceFlag(f.(*Float64SliceFlag)))
|
||||
stringifyFloat64SliceFlag(f))
|
||||
case *StringSliceFlag:
|
||||
return withEnvHint(flagStringSliceField(f, "EnvVars"),
|
||||
stringifyStringSliceFlag(f.(*StringSliceFlag)))
|
||||
stringifyStringSliceFlag(f))
|
||||
}
|
||||
|
||||
placeholder, usage := unquoteUsage(fv.FieldByName("Usage").String())
|
||||
|
Loading…
Reference in New Issue
Block a user