Fixed interface usage
This commit is contained in:
parent
ede43deb48
commit
00bcc6c5d2
|
@ -552,12 +552,12 @@ func unmarshal(e interface{}, in []byte) (n int, err error) {
|
||||||
var key string
|
var key string
|
||||||
t := reflect.TypeOf(e)
|
t := reflect.TypeOf(e)
|
||||||
v := reflect.ValueOf(e)
|
v := reflect.ValueOf(e)
|
||||||
if t.Kind() != reflect.Ptr || v.IsNil() {
|
if !v.IsValid() || t.Kind() != reflect.Ptr || v.IsNil() {
|
||||||
return 0, errors.New("ssob: Need a pointer that is fully allocated for unmarshalling")
|
return 0, errors.New("ssob: Need a pointer that is fully allocated for unmarshalling")
|
||||||
}
|
}
|
||||||
|
|
||||||
p := reflect.Indirect(v)
|
p := reflect.Indirect(v)
|
||||||
if p.Kind() != reflect.Ptr {
|
if p.Kind() != reflect.Ptr && p.Kind() != reflect.Interface {
|
||||||
switch p.Kind() {
|
switch p.Kind() {
|
||||||
case reflect.Bool, reflect.Int8, reflect.Int16, reflect.Int32,
|
case reflect.Bool, reflect.Int8, reflect.Int16, reflect.Int32,
|
||||||
reflect.Int64, reflect.Uint8, reflect.Uint16, reflect.Uint32,
|
reflect.Int64, reflect.Uint8, reflect.Uint16, reflect.Uint32,
|
||||||
|
|
Loading…
Reference in New Issue