From abbd16da6c9d374cb5da8907ec2355bd3571f80e Mon Sep 17 00:00:00 2001 From: Tao Wen Date: Wed, 2 Aug 2017 09:20:43 +0800 Subject: [PATCH] #140 blind fix --- feature_reflect_slice.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feature_reflect_slice.go b/feature_reflect_slice.go index f213408..7377eec 100644 --- a/feature_reflect_slice.go +++ b/feature_reflect_slice.go @@ -133,9 +133,9 @@ func growOne(slice *sliceHeader, sliceType reflect.Type, elementType reflect.Typ for i := uintptr(0); i < originalBytesCount; i++ { dstPtr[i] = srcPtr[i] } + slice.Data = dst slice.Len = newLen slice.Cap = newCap - slice.Data = dst } func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) { @@ -144,6 +144,6 @@ func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) { } newVal := reflect.MakeSlice(sliceType, 0, expectedCap) dst := unsafe.Pointer(newVal.Pointer()) - slice.Cap = expectedCap slice.Data = dst + slice.Cap = expectedCap }