overwrite initiliazed slices as empty slices

This commit is contained in:
İlker Göktuğ Öztürk 2015-07-17 16:06:31 +03:00
parent 5663048f13
commit bcd5600f39

View File

@ -30,7 +30,9 @@ 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))))
if !dest.IsNil() {
dest.Set(reflect.MakeSlice(dest.Type(), 0, 0))
}
if destType.Kind() == reflect.Ptr {
isPtr = true