Overwrite initiliazed slices as empty slices

This commit is contained in:
Jinzhu 2015-08-01 09:06:06 +08:00
parent 3f18890ca4
commit fa86433142
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ func Query(scope *Scope) {
if kind := dest.Kind(); kind == reflect.Slice {
isSlice = true
destType = dest.Type().Elem()
dest.Set(reflect.Indirect(reflect.New(reflect.SliceOf(destType))))
dest.Set(reflect.MakeSlice(dest.Type(), 0, 0))
if destType.Kind() == reflect.Ptr {
isPtr = true