From b3624047492eb594d905104783b63b03a918b80c Mon Sep 17 00:00:00 2001 From: double <2637309949@qq.com> Date: Sun, 16 Jun 2019 16:26:30 +0800 Subject: [PATCH] fixed test case no pass --- model_struct.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/model_struct.go b/model_struct.go index dcdf60ed..88c66abe 100644 --- a/model_struct.go +++ b/model_struct.go @@ -155,15 +155,11 @@ func (scope *Scope) GetModelStruct() *ModelStruct { return &modelStruct } - if reflect.ValueOf(scope.Value).Kind() != reflect.Ptr { - panic("results argument must be a ptr or slice") - } - - if reflect.ValueOf(scope.Value).Elem().Kind() == reflect.Interface { - // for reflect params + if reflect.ValueOf(scope.Value).Kind() == reflect.Ptr && reflect.ValueOf(scope.Value).Elem().Kind() == reflect.Interface { + // For reflect params reflectType = reflect.ValueOf(scope.Value).Elem().Elem().Type() } else { - // for struct params + // For struct params reflectType = reflect.ValueOf(scope.Value).Type() }