diff options
author | Nikolay Edigaryev <edigaryev@gmail.com> | 2021-02-18 01:43:23 +0300 |
---|---|---|
committer | Nikolay Edigaryev <edigaryev@gmail.com> | 2021-02-18 01:43:23 +0300 |
commit | e022c19753182cfb85f8f49354d493ee3a3147a3 (patch) | |
tree | 0be6a6b3c6245d048d68c3f3b14d291a50d2a9e3 /pkg/bindings/util | |
parent | 3e168b19f23d3e9e4e9f25d0368b4d607968abb4 (diff) | |
download | podman-e022c19753182cfb85f8f49354d493ee3a3147a3.tar.gz podman-e022c19753182cfb85f8f49354d493ee3a3147a3.tar.bz2 podman-e022c19753182cfb85f8f49354d493ee3a3147a3.zip |
Don't switch on a single case
Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
Diffstat (limited to 'pkg/bindings/util')
-rw-r--r-- | pkg/bindings/util/util.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/pkg/bindings/util/util.go b/pkg/bindings/util/util.go index 2d65ae9fd..c1961308e 100644 --- a/pkg/bindings/util/util.go +++ b/pkg/bindings/util/util.go @@ -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() { |