diff --git a/compiler/natives/src/encoding/gob/gob.go b/compiler/natives/src/encoding/gob/gob.go index f21315171..244f72ed7 100644 --- a/compiler/natives/src/encoding/gob/gob.go +++ b/compiler/natives/src/encoding/gob/gob.go @@ -26,9 +26,9 @@ func (x *atomicEncEnginePointer) Store(val *encEngine) { x.v = val } // temporarily replacement of growSlice[E any] for go1.20 without generics. func growSlice(v reflect.Value, ps any, length int) { - vps := reflect.ValueOf(ps) - vs := vps.Elem() - zero := reflect.Zero(vs.Elem().Type()) + vps := reflect.ValueOf(ps) // *[]E + vs := vps.Elem() // []E + zero := reflect.Zero(vs.Type().Elem()) vs.Set(reflect.Append(vs, zero)) cp := vs.Cap() if cp > length { @@ -36,5 +36,4 @@ func growSlice(v reflect.Value, ps any, length int) { } vs.Set(vs.Slice(0, cp)) v.Set(vs) - vps.Set(vs.Addr()) } diff --git a/compiler/natives/src/encoding/gob/gob_test.go b/compiler/natives/src/encoding/gob/gob_test.go index 823b572ac..a2f303ab6 100644 --- a/compiler/natives/src/encoding/gob/gob_test.go +++ b/compiler/natives/src/encoding/gob/gob_test.go @@ -105,3 +105,11 @@ func TestTypeRace(t *testing.T) { // cannot succeed when nosync is used. t.Skip("using nosync") } + +func TestCountEncodeMallocs(t *testing.T) { + t.Skip("testing.AllocsPerRun not supported in GopherJS") +} + +func TestCountDecodeMallocs(t *testing.T) { + t.Skip("testing.AllocsPerRun not supported in GopherJS") +}