using own usage func #42

Merged
vtolstov merged 3 commits from usage into v3 2022-04-02 15:22:13 +03:00
Showing only changes of commit 9a3a9283bd - Show all commits

17
util.go
View File

@ -87,7 +87,6 @@ func (v *sliceValue) String() string {
return v.def
}
func (v *sliceValue) Get() interface{} {
return v.v.Interface()
}
@ -407,19 +406,3 @@ func getFlagOpts(tf string) (string, string, string) {
}
return name, desc, def
}
func isZeroValue(f *flag.Flag, value string) bool {
// Build a zero value of the flag's Value type, and see if the
// result of calling its String method equals the value passed in.
// This works unless the Value type is itself an interface type.
typ := reflect.TypeOf(f.Value)
var z reflect.Value
if typ.Kind() == reflect.Pointer {
z = reflect.New(typ.Elem())
} else {
z = reflect.Zero(typ)
}
return value == z.Interface().(flag.Value).String()
}