Don't switch on a single case

Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
This commit is contained in:
Nikolay Edigaryev
2021-02-18 01:43:23 +03:00
parent 3e168b19f2
commit e022c19753

View File

@ -12,8 +12,7 @@ import (
)
func IsSimpleType(f reflect.Value) bool {
switch f.Interface().(type) {
case fmt.Stringer:
if _, ok := f.Interface().(fmt.Stringer); ok {
return true
}
@ -26,9 +25,8 @@ func IsSimpleType(f reflect.Value) bool {
}
func SimpleTypeToParam(f reflect.Value) string {
switch cast := f.Interface().(type) {
case fmt.Stringer:
return cast.String()
if s, ok := f.Interface().(fmt.Stringer); ok {
return s.String()
}
switch f.Kind() {