diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-04-21 03:30:02 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-04-28 18:41:47 +0800 |
commit | 4880868c88b8d82cda8ea615bf82548667a95da2 (patch) | |
tree | 973857d454e2f70b100f190ad40bb3c32f1cdd0b /accounts/abi/error.go | |
parent | c3d5250473794e5b7732e0d06941a6736cff2fca (diff) | |
download | go-tangerine-4880868c88b8d82cda8ea615bf82548667a95da2.tar go-tangerine-4880868c88b8d82cda8ea615bf82548667a95da2.tar.gz go-tangerine-4880868c88b8d82cda8ea615bf82548667a95da2.tar.bz2 go-tangerine-4880868c88b8d82cda8ea615bf82548667a95da2.tar.lz go-tangerine-4880868c88b8d82cda8ea615bf82548667a95da2.tar.xz go-tangerine-4880868c88b8d82cda8ea615bf82548667a95da2.tar.zst go-tangerine-4880868c88b8d82cda8ea615bf82548667a95da2.zip |
accounts/abi: fixed string and fixed size bytes packing
Diffstat (limited to 'accounts/abi/error.go')
-rw-r--r-- | accounts/abi/error.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/accounts/abi/error.go b/accounts/abi/error.go index 91a0374fd..67739c21d 100644 --- a/accounts/abi/error.go +++ b/accounts/abi/error.go @@ -33,7 +33,7 @@ func formatSliceString(kind reflect.Kind, sliceSize int) string { // sliceTypeCheck checks that the given slice can by assigned to the reflection // type in t. func sliceTypeCheck(t Type, val reflect.Value) error { - if !(val.Kind() == reflect.Slice || val.Kind() == reflect.Array) { + if val.Kind() != reflect.Slice && val.Kind() != reflect.Array { return typeErr(formatSliceString(t.Kind, t.SliceSize), val.Type()) } if t.IsArray && val.Len() != t.SliceSize { @@ -48,14 +48,13 @@ func sliceTypeCheck(t Type, val reflect.Value) error { return sliceTypeCheck(*t.Elem, val.Index(0)) } - elemKind := val.Type().Elem().Kind() - if elemKind != t.Elem.Kind { + if elemKind := val.Type().Elem().Kind(); elemKind != t.Elem.Kind { return typeErr(formatSliceString(t.Elem.Kind, t.SliceSize), val.Type()) } return nil } -// typeCheck checks that thet given reflection val can be assigned to the reflection +// typeCheck checks that the given reflection value can be assigned to the reflection // type in t. func typeCheck(t Type, value reflect.Value) error { if t.IsSlice || t.IsArray { |