Skip to content

Commit

Permalink
Don't switch on a single case
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Edigaryev <[email protected]>
  • Loading branch information
edigaryev committed Feb 17, 2021
1 parent 3e168b1 commit e022c19
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/bindings/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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() {
Expand Down

0 comments on commit e022c19

Please sign in to comment.