From 8d8355d81f81e12fff3c734930e87a291c6817c0 Mon Sep 17 00:00:00 2001 From: Jacques Marais Date: Sat, 7 Sep 2019 08:49:04 +0000 Subject: [PATCH 1/3] tests. added test case for issue (#619). Compare marshaling between a proto.Buffer and proto.Marshal with different proto.Buffer sizes. --- Makefile | 1 + test/protobuffer/Makefile | 31 ++++ test/protobuffer/protobuffer.pb.go | 220 +++++++++++++++++++++++++++ test/protobuffer/protobuffer.proto | 47 ++++++ test/protobuffer/protobuffer_test.go | 78 ++++++++++ 5 files changed, 377 insertions(+) mode change 100755 => 100644 Makefile create mode 100644 test/protobuffer/Makefile create mode 100644 test/protobuffer/protobuffer.pb.go create mode 100644 test/protobuffer/protobuffer.proto create mode 100644 test/protobuffer/protobuffer_test.go diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 68a02b1669..8b65f79829 --- a/Makefile +++ b/Makefile @@ -137,6 +137,7 @@ regenerate: make -C test/issue503 regenerate make -C test/issue530 regenerate make -C test/issue617 regenerate + make -C test/protobuffer regenerate make gofmt diff --git a/test/protobuffer/Makefile b/test/protobuffer/Makefile new file mode 100644 index 0000000000..00e39f73f4 --- /dev/null +++ b/test/protobuffer/Makefile @@ -0,0 +1,31 @@ +# Protocol Buffers for Go with Gadgets +# +# Copyright (c) 2019, The GoGo Authors. All rights reserved. +# http://github.com/gogo/protobuf +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +regenerate: + go install github.com/gogo/protobuf/protoc-gen-gogo + protoc --gogo_out=. --proto_path=../../../../../:../../protobuf/:. *.proto diff --git a/test/protobuffer/protobuffer.pb.go b/test/protobuffer/protobuffer.pb.go new file mode 100644 index 0000000000..ae8df3a673 --- /dev/null +++ b/test/protobuffer/protobuffer.pb.go @@ -0,0 +1,220 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: protobuffer.proto + +package protobuffer + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type PBuffMarshal struct { + Field1 []byte `protobuf:"bytes,1,opt,name=Field1" json:"Field1,omitempty"` + Field2 *int32 `protobuf:"varint,2,opt,name=Field2" json:"Field2,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PBuffMarshal) Reset() { *m = PBuffMarshal{} } +func (m *PBuffMarshal) String() string { return proto.CompactTextString(m) } +func (*PBuffMarshal) ProtoMessage() {} +func (*PBuffMarshal) Descriptor() ([]byte, []int) { + return fileDescriptor_12798c2215df1728, []int{0} +} +func (m *PBuffMarshal) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PBuffMarshal.Unmarshal(m, b) +} +func (m *PBuffMarshal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PBuffMarshal.Marshal(b, m, deterministic) +} +func (m *PBuffMarshal) XXX_Merge(src proto.Message) { + xxx_messageInfo_PBuffMarshal.Merge(m, src) +} +func (m *PBuffMarshal) XXX_Size() int { + return xxx_messageInfo_PBuffMarshal.Size(m) +} +func (m *PBuffMarshal) XXX_DiscardUnknown() { + xxx_messageInfo_PBuffMarshal.DiscardUnknown(m) +} + +var xxx_messageInfo_PBuffMarshal proto.InternalMessageInfo + +func (m *PBuffMarshal) GetField1() []byte { + if m != nil { + return m.Field1 + } + return nil +} + +func (m *PBuffMarshal) GetField2() int32 { + if m != nil && m.Field2 != nil { + return *m.Field2 + } + return 0 +} + +type PBuffMarshaler struct { + Field1 []byte `protobuf:"bytes,1,opt,name=Field1" json:"Field1,omitempty"` + Field2 *int32 `protobuf:"varint,2,opt,name=Field2" json:"Field2,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PBuffMarshaler) Reset() { *m = PBuffMarshaler{} } +func (m *PBuffMarshaler) String() string { return proto.CompactTextString(m) } +func (*PBuffMarshaler) ProtoMessage() {} +func (*PBuffMarshaler) Descriptor() ([]byte, []int) { + return fileDescriptor_12798c2215df1728, []int{1} +} +func (m *PBuffMarshaler) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PBuffMarshaler.Unmarshal(m, b) +} +func (m *PBuffMarshaler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PBuffMarshaler.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PBuffMarshaler) XXX_Merge(src proto.Message) { + xxx_messageInfo_PBuffMarshaler.Merge(m, src) +} +func (m *PBuffMarshaler) XXX_Size() int { + return m.Size() +} +func (m *PBuffMarshaler) XXX_DiscardUnknown() { + xxx_messageInfo_PBuffMarshaler.DiscardUnknown(m) +} + +var xxx_messageInfo_PBuffMarshaler proto.InternalMessageInfo + +func (m *PBuffMarshaler) GetField1() []byte { + if m != nil { + return m.Field1 + } + return nil +} + +func (m *PBuffMarshaler) GetField2() int32 { + if m != nil && m.Field2 != nil { + return *m.Field2 + } + return 0 +} + +func init() { + proto.RegisterType((*PBuffMarshal)(nil), "protobuffer.PBuffMarshal") + proto.RegisterType((*PBuffMarshaler)(nil), "protobuffer.PBuffMarshaler") +} + +func init() { proto.RegisterFile("protobuffer.proto", fileDescriptor_12798c2215df1728) } + +var fileDescriptor_12798c2215df1728 = []byte{ + // 144 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x28, 0xca, 0x2f, + 0xc9, 0x4f, 0x2a, 0x4d, 0x4b, 0x4b, 0x2d, 0xd2, 0x03, 0xb3, 0x85, 0xb8, 0x91, 0x84, 0xa4, 0x74, + 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, + 0x61, 0x92, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xf4, 0x2a, 0x79, 0x70, 0xf1, 0x04, 0x38, 0x95, + 0xa6, 0xa5, 0xf9, 0x26, 0x16, 0x15, 0x67, 0x24, 0xe6, 0x08, 0x89, 0x71, 0xb1, 0xb9, 0x65, 0xa6, + 0xe6, 0xa4, 0x18, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x41, 0x79, 0x70, 0x71, 0x23, 0x09, + 0x26, 0x05, 0x46, 0x0d, 0x56, 0xa8, 0xb8, 0x91, 0x15, 0x47, 0xc7, 0x42, 0x79, 0x86, 0x05, 0x0b, + 0xe5, 0x19, 0x94, 0xbc, 0xb8, 0xf8, 0x90, 0x4d, 0x4a, 0x2d, 0x22, 0xcb, 0x2c, 0xc6, 0x05, 0x0b, + 0xe5, 0x19, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x9d, 0x92, 0xe0, 0xe5, 0x00, 0x00, 0x00, +} + +func (m *PBuffMarshaler) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PBuffMarshaler) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PBuffMarshaler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Field2 != nil { + i = encodeVarintProtobuffer(dAtA, i, uint64(*m.Field2)) + i-- + dAtA[i] = 0x10 + } + if m.Field1 != nil { + i -= len(m.Field1) + copy(dAtA[i:], m.Field1) + i = encodeVarintProtobuffer(dAtA, i, uint64(len(m.Field1))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintProtobuffer(dAtA []byte, offset int, v uint64) int { + offset -= sovProtobuffer(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PBuffMarshaler) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Field1 != nil { + l = len(m.Field1) + n += 1 + l + sovProtobuffer(uint64(l)) + } + if m.Field2 != nil { + n += 1 + sovProtobuffer(uint64(*m.Field2)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovProtobuffer(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozProtobuffer(x uint64) (n int) { + return sovProtobuffer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} diff --git a/test/protobuffer/protobuffer.proto b/test/protobuffer/protobuffer.proto new file mode 100644 index 0000000000..43743cda07 --- /dev/null +++ b/test/protobuffer/protobuffer.proto @@ -0,0 +1,47 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2019, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; + +package protobuffer; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +message PBuffMarshal { + option (gogoproto.marshaler) = false; + option (gogoproto.sizer) = false; + optional bytes Field1 = 1; + optional int32 Field2 = 2; +} + +message PBuffMarshaler { + option (gogoproto.marshaler) = true; + option (gogoproto.sizer) = true; + optional bytes Field1 = 1; + optional int32 Field2 = 2; +} diff --git a/test/protobuffer/protobuffer_test.go b/test/protobuffer/protobuffer_test.go new file mode 100644 index 0000000000..79fef6142a --- /dev/null +++ b/test/protobuffer/protobuffer_test.go @@ -0,0 +1,78 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2019, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package protobuffer + +import ( + "bytes" + "testing" + + proto "github.com/gogo/protobuf/proto" +) + +func TestProtoBufferMarshal12(t *testing.T) { + i := int32(33) + m := &PBuffMarshal{Field1: []byte(string("Tester123")), Field2: &i} + mer := &PBuffMarshaler{Field1: []byte(string("Tester123")), Field2: &i} + testCases := []struct { + name string + size int + m proto.Message + }{ + {"MarshalLarge", 1024, m}, + {"MarshalSmall", 0, m}, + {"MarshalerLarge", 1024, mer}, + {"MarshalerSmall", 0, mer}, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + marshalCheck(t, tc.m, tc.size) + }) + } +} + +func marshalCheck(t *testing.T, m proto.Message, size int) { + buf := proto.NewBuffer(make([]byte, 0, size)) + err := buf.Marshal(m) + if err != nil { + t.Fatal(err) + } + err = buf.Marshal(m) + if err != nil { + t.Fatal(err) + } + bufferBytes := buf.Bytes() + protoBytes, err := proto.Marshal(m) + if err != nil { + t.Fatal(err) + } + protoBytes = append(protoBytes, protoBytes...) + if !bytes.Equal(bufferBytes, protoBytes) { + t.Fatalf("proto.Buffer Marshal != proto.Marshal (%v != %v)\n", bufferBytes, protoBytes) + } +} From e86a61c349c097b817143d37017dd449e61929cc Mon Sep 17 00:00:00 2001 From: Antoine Pelisse Date: Mon, 9 Sep 2019 13:49:54 -0700 Subject: [PATCH 2/3] Fix confusion between slice capacity and length --- proto/table_marshal.go | 24 ++++++++++++++++++++++++ protoc-gen-gogo/generator/generator.go | 6 ++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/proto/table_marshal.go b/proto/table_marshal.go index db9927a0c7..ab20de6f4d 100644 --- a/proto/table_marshal.go +++ b/proto/table_marshal.go @@ -2930,10 +2930,23 @@ func Size(pb Message) int { return info.Size(pb) } +type reverseMarshaler interface { + MarshalToSizedBuffer([]byte) (int, error) + Size() int +} + // Marshal takes a protocol buffer message // and encodes it into the wire format, returning the data. // This is the main entry point. func Marshal(pb Message) ([]byte, error) { + if m, ok := pb.(reverseMarshaler); ok { + b := make([]byte, m.Size()) + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } if m, ok := pb.(newMarshaler); ok { siz := m.XXX_Size() b := make([]byte, 0, siz) @@ -2965,6 +2978,17 @@ func (p *Buffer) Marshal(pb Message) error { if _, ok := pb.(Marshaler); ok { return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) } + if _, ok := pb.(reverseMarshaler); ok { + return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) + } + + } + if m, ok := pb.(reverseMarshaler); ok { + siz := m.Size() + p.grow(siz) // make sure buf has enough capacity + n, err := m.MarshalToSizedBuffer(p.buf[len(p.buf) : len(p.buf)+siz]) + p.buf = p.buf[:len(p.buf)+n] + return err } if m, ok := pb.(newMarshaler); ok { siz := m.XXX_Size() diff --git a/protoc-gen-gogo/generator/generator.go b/protoc-gen-gogo/generator/generator.go index dd260f142c..985ba4fd71 100644 --- a/protoc-gen-gogo/generator/generator.go +++ b/protoc-gen-gogo/generator/generator.go @@ -2717,8 +2717,7 @@ func (g *Generator) generateCommonMethods(mc *msgCtx) { if gogoproto.IsMarshaler(g.file.FileDescriptorProto, mc.message.DescriptorProto) || gogoproto.IsUnsafeMarshaler(g.file.FileDescriptorProto, mc.message.DescriptorProto) { if gogoproto.IsStableMarshaler(g.file.FileDescriptorProto, mc.message.DescriptorProto) { - g.P("b = b[:cap(b)]") - g.P("n, err := m.MarshalToSizedBuffer(b)") + g.P("n, err := m.MarshalTo(b)") g.P("if err != nil {") g.In() g.P("return nil, err") @@ -2731,8 +2730,7 @@ func (g *Generator) generateCommonMethods(mc *msgCtx) { g.P("return xxx_messageInfo_", mc.goName, ".Marshal(b, m, deterministic)") g.P("} else {") g.In() - g.P("b = b[:cap(b)]") - g.P("n, err := m.MarshalToSizedBuffer(b)") + g.P("n, err := m.MarshalTo(b)") g.P("if err != nil {") g.In() g.P("return nil, err") From 06b3fdc0bc8d1d6e15e5bc7a2279373894d7bf84 Mon Sep 17 00:00:00 2001 From: Antoine Pelisse Date: Mon, 9 Sep 2019 15:53:35 -0700 Subject: [PATCH 3/3] Regenerate all protobuf code --- test/asymetric-issue125/asym.pb.go | 3 +- test/casttype/combos/both/casttype.pb.go | 6 +- test/casttype/combos/marshaler/casttype.pb.go | 6 +- test/castvalue/combos/both/castvalue.pb.go | 6 +- .../combos/marshaler/castvalue.pb.go | 6 +- test/combos/both/thetest.pb.go | 204 ++++++------------ test/combos/marshaler/thetest.pb.go | 204 ++++++------------ test/data/data.pb.go | 3 +- test/deterministic/deterministic.pb.go | 18 +- test/enumdecl/enumdecl.pb.go | 3 +- test/enumdecl_all/enumdeclall.pb.go | 3 +- test/example/example.pb.go | 21 +- test/fuzztests/fuzz.pb.go | 12 +- test/importcustom-issue389/imported/a.pb.go | 3 +- test/importcustom-issue389/importing/c.pb.go | 3 +- test/indeximport-issue72/index/index.pb.go | 3 +- test/indeximport-issue72/indeximport.pb.go | 3 +- test/int64support/object.pb.go | 3 +- test/issue260/issue260.pb.go | 9 +- test/issue261/issue261.pb.go | 3 +- test/issue262/timefail.pb.go | 3 +- test/issue322/issue322.pb.go | 3 +- test/issue330/issue330.pb.go | 3 +- test/issue42order/issue42.pb.go | 6 +- test/issue449/issue449.pb.go | 3 +- test/issue498/issue498.pb.go | 3 +- test/issue503/issue503.pb.go | 3 +- test/issue530/issue530.pb.go | 27 +-- test/issue617/issue617.pb.go | 6 +- test/mapdefaults/combos/both/map.pb.go | 9 +- test/mapdefaults/combos/marshaler/map.pb.go | 9 +- test/mapsproto2/combos/both/mapsproto2.pb.go | 12 +- .../combos/marshaler/mapsproto2.pb.go | 12 +- test/nopackage/nopackage.pb.go | 3 +- test/oneof/combos/both/one.pb.go | 12 +- test/oneof/combos/marshaler/one.pb.go | 12 +- test/oneof3/combos/both/one.pb.go | 6 +- test/oneof3/combos/marshaler/one.pb.go | 6 +- test/protobuffer/protobuffer.pb.go | 3 +- test/protosize/protosize.pb.go | 3 +- test/required/requiredexample.pb.go | 12 +- test/sizeunderscore/sizeunderscore.pb.go | 3 +- test/theproto3/combos/both/theproto3.pb.go | 30 +-- .../combos/marshaler/theproto3.pb.go | 30 +-- test/typedecl/typedecl.pb.go | 9 +- test/typedecl_all/typedeclall.pb.go | 9 +- test/types/combos/both/types.pb.go | 27 +-- test/types/combos/marshaler/types.pb.go | 27 +-- test/unrecognized/unrecognized.pb.go | 27 +-- .../unrecognizedgroup/unrecognizedgroup.pb.go | 6 +- types/any.pb.go | 3 +- types/api.pb.go | 9 +- types/duration.pb.go | 3 +- types/empty.pb.go | 3 +- types/field_mask.pb.go | 3 +- types/source_context.pb.go | 3 +- types/struct.pb.go | 9 +- types/timestamp.pb.go | 3 +- types/type.pb.go | 15 +- types/wrappers.pb.go | 27 +-- vanity/test/fast/gogovanity.pb.go | 3 +- vanity/test/fast/proto3.pb.go | 3 +- vanity/test/fast/vanity.pb.go | 3 +- vanity/test/faster/gogovanity.pb.go | 3 +- vanity/test/faster/proto3.pb.go | 3 +- vanity/test/faster/vanity.pb.go | 3 +- vanity/test/slick/gogovanity.pb.go | 3 +- vanity/test/slick/proto3.pb.go | 3 +- vanity/test/slick/vanity.pb.go | 3 +- 69 files changed, 317 insertions(+), 634 deletions(-) diff --git a/test/asymetric-issue125/asym.pb.go b/test/asymetric-issue125/asym.pb.go index 22fef6aee1..815bc840c5 100644 --- a/test/asymetric-issue125/asym.pb.go +++ b/test/asymetric-issue125/asym.pb.go @@ -44,8 +44,7 @@ func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_M.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/casttype/combos/both/casttype.pb.go b/test/casttype/combos/both/casttype.pb.go index a998e58240..83f3fe3ddf 100644 --- a/test/casttype/combos/both/casttype.pb.go +++ b/test/casttype/combos/both/casttype.pb.go @@ -67,8 +67,7 @@ func (m *Castaway) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Castaway.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -106,8 +105,7 @@ func (m *Wilson) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Wilson.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/casttype/combos/marshaler/casttype.pb.go b/test/casttype/combos/marshaler/casttype.pb.go index 71c0990af9..e863febd04 100644 --- a/test/casttype/combos/marshaler/casttype.pb.go +++ b/test/casttype/combos/marshaler/casttype.pb.go @@ -66,8 +66,7 @@ func (m *Castaway) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Castaway.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -105,8 +104,7 @@ func (m *Wilson) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Wilson.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/castvalue/combos/both/castvalue.pb.go b/test/castvalue/combos/both/castvalue.pb.go index e1761bc2fd..c9aae4fcf4 100644 --- a/test/castvalue/combos/both/castvalue.pb.go +++ b/test/castvalue/combos/both/castvalue.pb.go @@ -51,8 +51,7 @@ func (m *Castaway) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Castaway.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -90,8 +89,7 @@ func (m *Wilson) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Wilson.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/castvalue/combos/marshaler/castvalue.pb.go b/test/castvalue/combos/marshaler/castvalue.pb.go index 65c2003fb9..982ad1551a 100644 --- a/test/castvalue/combos/marshaler/castvalue.pb.go +++ b/test/castvalue/combos/marshaler/castvalue.pb.go @@ -50,8 +50,7 @@ func (m *Castaway) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Castaway.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -89,8 +88,7 @@ func (m *Wilson) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Wilson.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/combos/both/thetest.pb.go b/test/combos/both/thetest.pb.go index 08b25b5387..c0e01df51b 100644 --- a/test/combos/both/thetest.pb.go +++ b/test/combos/both/thetest.pb.go @@ -273,8 +273,7 @@ func (m *NidOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -326,8 +325,7 @@ func (m *NinOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -379,8 +377,7 @@ func (m *NidRepNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidRepNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -432,8 +429,7 @@ func (m *NinRepNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinRepNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -483,8 +479,7 @@ func (m *NidRepPackedNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NidRepPackedNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -534,8 +529,7 @@ func (m *NinRepPackedNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NinRepPackedNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -582,8 +576,7 @@ func (m *NidOptStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidOptStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -630,8 +623,7 @@ func (m *NinOptStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -678,8 +670,7 @@ func (m *NidRepStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidRepStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -726,8 +717,7 @@ func (m *NinRepStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinRepStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -767,8 +757,7 @@ func (m *NidEmbeddedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NidEmbeddedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -808,8 +797,7 @@ func (m *NinEmbeddedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinEmbeddedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -848,8 +836,7 @@ func (m *NidNestedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_NidNestedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -888,8 +875,7 @@ func (m *NinNestedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_NinNestedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -928,8 +914,7 @@ func (m *NidOptCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidOptCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -967,8 +952,7 @@ func (m *CustomDash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CustomDash.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1007,8 +991,7 @@ func (m *NinOptCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1047,8 +1030,7 @@ func (m *NidRepCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidRepCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1087,8 +1069,7 @@ func (m *NinRepCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinRepCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1134,8 +1115,7 @@ func (m *NinOptNativeUnion) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinOptNativeUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1181,8 +1161,7 @@ func (m *NinOptStructUnion) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinOptStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1222,8 +1201,7 @@ func (m *NinEmbeddedStructUnion) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_NinEmbeddedStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1263,8 +1241,7 @@ func (m *NinNestedStructUnion) XXX_Marshal(b []byte, deterministic bool) ([]byte if deterministic { return xxx_messageInfo_NinNestedStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1304,8 +1281,7 @@ func (m *Tree) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Tree.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1344,8 +1320,7 @@ func (m *OrBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OrBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1384,8 +1359,7 @@ func (m *AndBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AndBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1424,8 +1398,7 @@ func (m *Leaf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Leaf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1465,8 +1438,7 @@ func (m *DeepTree) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_DeepTree.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1504,8 +1476,7 @@ func (m *ADeepBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_ADeepBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1544,8 +1515,7 @@ func (m *AndDeepBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_AndDeepBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1583,8 +1553,7 @@ func (m *DeepLeaf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_DeepLeaf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1621,8 +1590,7 @@ func (m *Nil) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Nil.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1660,8 +1628,7 @@ func (m *NidOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NidOptEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1701,8 +1668,7 @@ func (m *NinOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NinOptEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1742,8 +1708,7 @@ func (m *NidRepEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NidRepEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1783,8 +1748,7 @@ func (m *NinRepEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NinRepEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1824,8 +1788,7 @@ func (m *NinOptEnumDefault) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinOptEnumDefault.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1890,8 +1853,7 @@ func (m *AnotherNinOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_AnotherNinOptEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1931,8 +1893,7 @@ func (m *AnotherNinOptEnumDefault) XXX_Marshal(b []byte, deterministic bool) ([] if deterministic { return xxx_messageInfo_AnotherNinOptEnumDefault.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1997,8 +1958,7 @@ func (m *Timer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Timer.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2046,8 +2006,7 @@ func (m *MyExtendable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_MyExtendable.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2098,8 +2057,7 @@ func (m *OtherExtenable) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro if deterministic { return xxx_messageInfo_OtherExtenable.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2140,8 +2098,7 @@ func (m *NestedDefinition) XXX_Marshal(b []byte, deterministic bool) ([]byte, er if deterministic { return xxx_messageInfo_NestedDefinition.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2180,8 +2137,7 @@ func (m *NestedDefinition_NestedMessage) XXX_Marshal(b []byte, deterministic boo if deterministic { return xxx_messageInfo_NestedDefinition_NestedMessage.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2221,8 +2177,7 @@ func (m *NestedDefinition_NestedMessage_NestedNestedMsg) XXX_Marshal(b []byte, d if deterministic { return xxx_messageInfo_NestedDefinition_NestedMessage_NestedNestedMsg.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2262,8 +2217,7 @@ func (m *NestedScope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NestedScope.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2315,8 +2269,7 @@ func (m *NinOptNativeDefault) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NinOptNativeDefault.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2474,8 +2427,7 @@ func (m *CustomContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_CustomContainer.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2527,8 +2479,7 @@ func (m *CustomNameNidOptNative) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_CustomNameNidOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2580,8 +2531,7 @@ func (m *CustomNameNinOptNative) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_CustomNameNinOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2633,8 +2583,7 @@ func (m *CustomNameNinRepNative) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_CustomNameNinRepNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2681,8 +2630,7 @@ func (m *CustomNameNinStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_CustomNameNinStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2723,8 +2671,7 @@ func (m *CustomNameCustomType) XXX_Marshal(b []byte, deterministic bool) ([]byte if deterministic { return xxx_messageInfo_CustomNameCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2764,8 +2711,7 @@ func (m *CustomNameNinEmbeddedStructUnion) XXX_Marshal(b []byte, deterministic b if deterministic { return xxx_messageInfo_CustomNameNinEmbeddedStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2804,8 +2750,7 @@ func (m *CustomNameEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro if deterministic { return xxx_messageInfo_CustomNameEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2859,8 +2804,7 @@ func (m *NoExtensionsMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_NoExtensionsMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2897,8 +2841,7 @@ func (m *Unrecognized) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_Unrecognized.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2937,8 +2880,7 @@ func (m *UnrecognizedWithInner) XXX_Marshal(b []byte, deterministic bool) ([]byt if deterministic { return xxx_messageInfo_UnrecognizedWithInner.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2975,8 +2917,7 @@ func (m *UnrecognizedWithInner_Inner) XXX_Marshal(b []byte, deterministic bool) if deterministic { return xxx_messageInfo_UnrecognizedWithInner_Inner.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3015,8 +2956,7 @@ func (m *UnrecognizedWithEmbed) XXX_Marshal(b []byte, deterministic bool) ([]byt if deterministic { return xxx_messageInfo_UnrecognizedWithEmbed.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3053,8 +2993,7 @@ func (m *UnrecognizedWithEmbed_Embedded) XXX_Marshal(b []byte, deterministic boo if deterministic { return xxx_messageInfo_UnrecognizedWithEmbed_Embedded.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3093,8 +3032,7 @@ func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Node.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3132,8 +3070,7 @@ func (m *NonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3171,8 +3108,7 @@ func (m *NidOptNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NidOptNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3210,8 +3146,7 @@ func (m *NinOptNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NinOptNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3249,8 +3184,7 @@ func (m *NidRepNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NidRepNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3288,8 +3222,7 @@ func (m *NinRepNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NinRepNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3327,8 +3260,7 @@ func (m *ProtoType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ProtoType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/combos/marshaler/thetest.pb.go b/test/combos/marshaler/thetest.pb.go index ee2a83afa5..93adba2751 100644 --- a/test/combos/marshaler/thetest.pb.go +++ b/test/combos/marshaler/thetest.pb.go @@ -272,8 +272,7 @@ func (m *NidOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -325,8 +324,7 @@ func (m *NinOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -378,8 +376,7 @@ func (m *NidRepNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidRepNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -431,8 +428,7 @@ func (m *NinRepNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinRepNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -482,8 +478,7 @@ func (m *NidRepPackedNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NidRepPackedNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -533,8 +528,7 @@ func (m *NinRepPackedNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NinRepPackedNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -581,8 +575,7 @@ func (m *NidOptStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidOptStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -629,8 +622,7 @@ func (m *NinOptStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -677,8 +669,7 @@ func (m *NidRepStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidRepStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -725,8 +716,7 @@ func (m *NinRepStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinRepStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -766,8 +756,7 @@ func (m *NidEmbeddedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NidEmbeddedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -807,8 +796,7 @@ func (m *NinEmbeddedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinEmbeddedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -847,8 +835,7 @@ func (m *NidNestedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_NidNestedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -887,8 +874,7 @@ func (m *NinNestedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_NinNestedStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -927,8 +913,7 @@ func (m *NidOptCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidOptCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -966,8 +951,7 @@ func (m *CustomDash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CustomDash.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1006,8 +990,7 @@ func (m *NinOptCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1046,8 +1029,7 @@ func (m *NidRepCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidRepCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1086,8 +1068,7 @@ func (m *NinRepCustom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinRepCustom.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1133,8 +1114,7 @@ func (m *NinOptNativeUnion) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinOptNativeUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1180,8 +1160,7 @@ func (m *NinOptStructUnion) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinOptStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1221,8 +1200,7 @@ func (m *NinEmbeddedStructUnion) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_NinEmbeddedStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1262,8 +1240,7 @@ func (m *NinNestedStructUnion) XXX_Marshal(b []byte, deterministic bool) ([]byte if deterministic { return xxx_messageInfo_NinNestedStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1303,8 +1280,7 @@ func (m *Tree) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Tree.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1343,8 +1319,7 @@ func (m *OrBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OrBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1383,8 +1358,7 @@ func (m *AndBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AndBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1423,8 +1397,7 @@ func (m *Leaf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Leaf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1464,8 +1437,7 @@ func (m *DeepTree) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_DeepTree.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1503,8 +1475,7 @@ func (m *ADeepBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_ADeepBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1543,8 +1514,7 @@ func (m *AndDeepBranch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_AndDeepBranch.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1582,8 +1552,7 @@ func (m *DeepLeaf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_DeepLeaf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1620,8 +1589,7 @@ func (m *Nil) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Nil.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1659,8 +1627,7 @@ func (m *NidOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NidOptEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1700,8 +1667,7 @@ func (m *NinOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NinOptEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1741,8 +1707,7 @@ func (m *NidRepEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NidRepEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1782,8 +1747,7 @@ func (m *NinRepEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NinRepEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1823,8 +1787,7 @@ func (m *NinOptEnumDefault) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NinOptEnumDefault.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1889,8 +1852,7 @@ func (m *AnotherNinOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_AnotherNinOptEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1930,8 +1892,7 @@ func (m *AnotherNinOptEnumDefault) XXX_Marshal(b []byte, deterministic bool) ([] if deterministic { return xxx_messageInfo_AnotherNinOptEnumDefault.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1996,8 +1957,7 @@ func (m *Timer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Timer.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2045,8 +2005,7 @@ func (m *MyExtendable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_MyExtendable.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2097,8 +2056,7 @@ func (m *OtherExtenable) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro if deterministic { return xxx_messageInfo_OtherExtenable.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2139,8 +2097,7 @@ func (m *NestedDefinition) XXX_Marshal(b []byte, deterministic bool) ([]byte, er if deterministic { return xxx_messageInfo_NestedDefinition.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2179,8 +2136,7 @@ func (m *NestedDefinition_NestedMessage) XXX_Marshal(b []byte, deterministic boo if deterministic { return xxx_messageInfo_NestedDefinition_NestedMessage.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2220,8 +2176,7 @@ func (m *NestedDefinition_NestedMessage_NestedNestedMsg) XXX_Marshal(b []byte, d if deterministic { return xxx_messageInfo_NestedDefinition_NestedMessage_NestedNestedMsg.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2261,8 +2216,7 @@ func (m *NestedScope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NestedScope.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2314,8 +2268,7 @@ func (m *NinOptNativeDefault) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NinOptNativeDefault.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2473,8 +2426,7 @@ func (m *CustomContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_CustomContainer.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2526,8 +2478,7 @@ func (m *CustomNameNidOptNative) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_CustomNameNidOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2579,8 +2530,7 @@ func (m *CustomNameNinOptNative) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_CustomNameNinOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2632,8 +2582,7 @@ func (m *CustomNameNinRepNative) XXX_Marshal(b []byte, deterministic bool) ([]by if deterministic { return xxx_messageInfo_CustomNameNinRepNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2680,8 +2629,7 @@ func (m *CustomNameNinStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_CustomNameNinStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2722,8 +2670,7 @@ func (m *CustomNameCustomType) XXX_Marshal(b []byte, deterministic bool) ([]byte if deterministic { return xxx_messageInfo_CustomNameCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2763,8 +2710,7 @@ func (m *CustomNameNinEmbeddedStructUnion) XXX_Marshal(b []byte, deterministic b if deterministic { return xxx_messageInfo_CustomNameNinEmbeddedStructUnion.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2803,8 +2749,7 @@ func (m *CustomNameEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro if deterministic { return xxx_messageInfo_CustomNameEnum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2858,8 +2803,7 @@ func (m *NoExtensionsMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_NoExtensionsMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2896,8 +2840,7 @@ func (m *Unrecognized) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_Unrecognized.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2936,8 +2879,7 @@ func (m *UnrecognizedWithInner) XXX_Marshal(b []byte, deterministic bool) ([]byt if deterministic { return xxx_messageInfo_UnrecognizedWithInner.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -2974,8 +2916,7 @@ func (m *UnrecognizedWithInner_Inner) XXX_Marshal(b []byte, deterministic bool) if deterministic { return xxx_messageInfo_UnrecognizedWithInner_Inner.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3014,8 +2955,7 @@ func (m *UnrecognizedWithEmbed) XXX_Marshal(b []byte, deterministic bool) ([]byt if deterministic { return xxx_messageInfo_UnrecognizedWithEmbed.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3052,8 +2992,7 @@ func (m *UnrecognizedWithEmbed_Embedded) XXX_Marshal(b []byte, deterministic boo if deterministic { return xxx_messageInfo_UnrecognizedWithEmbed_Embedded.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3092,8 +3031,7 @@ func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Node.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3131,8 +3069,7 @@ func (m *NonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_NonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3170,8 +3107,7 @@ func (m *NidOptNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NidOptNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3209,8 +3145,7 @@ func (m *NinOptNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NinOptNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3248,8 +3183,7 @@ func (m *NidRepNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NidRepNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3287,8 +3221,7 @@ func (m *NinRepNonByteCustomType) XXX_Marshal(b []byte, deterministic bool) ([]b if deterministic { return xxx_messageInfo_NinRepNonByteCustomType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -3326,8 +3259,7 @@ func (m *ProtoType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ProtoType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/data/data.pb.go b/test/data/data.pb.go index 8935639179..38654d0448 100644 --- a/test/data/data.pb.go +++ b/test/data/data.pb.go @@ -45,8 +45,7 @@ func (m *MyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MyMessage.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/deterministic/deterministic.pb.go b/test/deterministic/deterministic.pb.go index 8416bf534e..b52c3236f5 100644 --- a/test/deterministic/deterministic.pb.go +++ b/test/deterministic/deterministic.pb.go @@ -41,8 +41,7 @@ func (m *OrderedMap) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrderedMap.Unmarshal(m, b) } func (m *OrderedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -87,8 +86,7 @@ func (m *UnorderedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_UnorderedMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -170,8 +168,7 @@ func (m *NestedOrderedMap) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NestedOrderedMap.Unmarshal(m, b) } func (m *NestedOrderedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -220,8 +217,7 @@ func (m *NestedMap1) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NestedMap1.Unmarshal(m, b) } func (m *NestedMap1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -267,8 +263,7 @@ func (m *NestedUnorderedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NestedUnorderedMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -321,8 +316,7 @@ func (m *NestedMap2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NestedMap2.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/enumdecl/enumdecl.pb.go b/test/enumdecl/enumdecl.pb.go index f762751eb2..2baef6fed4 100644 --- a/test/enumdecl/enumdecl.pb.go +++ b/test/enumdecl/enumdecl.pb.go @@ -62,8 +62,7 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Message.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/enumdecl_all/enumdeclall.pb.go b/test/enumdecl_all/enumdeclall.pb.go index 2f0979a6a0..cccd1aa009 100644 --- a/test/enumdecl_all/enumdeclall.pb.go +++ b/test/enumdecl_all/enumdeclall.pb.go @@ -88,8 +88,7 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Message.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/example/example.pb.go b/test/example/example.pb.go index e23f67a638..b483b2e560 100644 --- a/test/example/example.pb.go +++ b/test/example/example.pb.go @@ -53,8 +53,7 @@ func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_A.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -93,8 +92,7 @@ func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_B.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -132,8 +130,7 @@ func (m *C) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_C.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -179,8 +176,7 @@ func (m *U) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_U.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -247,8 +243,7 @@ func (m *E) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_E.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -285,8 +280,7 @@ func (m *R) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_R.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -331,8 +325,7 @@ func (m *CastType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CastType.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/fuzztests/fuzz.pb.go b/test/fuzztests/fuzz.pb.go index d9f66affc6..4252e2f7a9 100644 --- a/test/fuzztests/fuzz.pb.go +++ b/test/fuzztests/fuzz.pb.go @@ -45,8 +45,7 @@ func (m *Nil) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Nil.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -97,8 +96,7 @@ func (m *NinRepPackedNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NinRepPackedNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -242,8 +240,7 @@ func (m *NinOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -396,8 +393,7 @@ func (m *NinOptStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptStruct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/importcustom-issue389/imported/a.pb.go b/test/importcustom-issue389/imported/a.pb.go index f8bfb01a6e..f48f239eaf 100644 --- a/test/importcustom-issue389/imported/a.pb.go +++ b/test/importcustom-issue389/imported/a.pb.go @@ -44,8 +44,7 @@ func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_A.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/importcustom-issue389/importing/c.pb.go b/test/importcustom-issue389/importing/c.pb.go index fe6b0d29d6..ddb5712694 100644 --- a/test/importcustom-issue389/importing/c.pb.go +++ b/test/importcustom-issue389/importing/c.pb.go @@ -46,8 +46,7 @@ func (m *C) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_C.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/indeximport-issue72/index/index.pb.go b/test/indeximport-issue72/index/index.pb.go index e3d3f01ca9..13f53c7715 100644 --- a/test/indeximport-issue72/index/index.pb.go +++ b/test/indeximport-issue72/index/index.pb.go @@ -45,8 +45,7 @@ func (m *IndexQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_IndexQuery.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/indeximport-issue72/indeximport.pb.go b/test/indeximport-issue72/indeximport.pb.go index 9083cb8976..092f6b5394 100644 --- a/test/indeximport-issue72/indeximport.pb.go +++ b/test/indeximport-issue72/indeximport.pb.go @@ -45,8 +45,7 @@ func (m *IndexQueries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_IndexQueries.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/int64support/object.pb.go b/test/int64support/object.pb.go index 9c80f6f139..64baa8413b 100644 --- a/test/int64support/object.pb.go +++ b/test/int64support/object.pb.go @@ -43,8 +43,7 @@ func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Object.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue260/issue260.pb.go b/test/issue260/issue260.pb.go index 891dadf753..f416f5c288 100644 --- a/test/issue260/issue260.pb.go +++ b/test/issue260/issue260.pb.go @@ -40,8 +40,7 @@ func (m *Dropped) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Dropped.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -87,8 +86,7 @@ func (m *DroppedWithoutGetters) XXX_Marshal(b []byte, deterministic bool) ([]byt if deterministic { return xxx_messageInfo_DroppedWithoutGetters.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -127,8 +125,7 @@ func (m *Kept) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Kept.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue261/issue261.pb.go b/test/issue261/issue261.pb.go index 38becbc0d8..a3357f9816 100644 --- a/test/issue261/issue261.pb.go +++ b/test/issue261/issue261.pb.go @@ -46,8 +46,7 @@ func (m *MapStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_MapStdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue262/timefail.pb.go b/test/issue262/timefail.pb.go index 4abf3ff160..0f7b5f6a83 100644 --- a/test/issue262/timefail.pb.go +++ b/test/issue262/timefail.pb.go @@ -45,8 +45,7 @@ func (m *TimeFail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TimeFail.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue322/issue322.pb.go b/test/issue322/issue322.pb.go index 1bd153fd9f..6c4e8e598b 100644 --- a/test/issue322/issue322.pb.go +++ b/test/issue322/issue322.pb.go @@ -48,8 +48,7 @@ func (m *OneofTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OneofTest.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue330/issue330.pb.go b/test/issue330/issue330.pb.go index 9114fafc3a..4e9d2d5b86 100644 --- a/test/issue330/issue330.pb.go +++ b/test/issue330/issue330.pb.go @@ -44,8 +44,7 @@ func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Object.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue42order/issue42.pb.go b/test/issue42order/issue42.pb.go index eef6d5384b..83a1221177 100644 --- a/test/issue42order/issue42.pb.go +++ b/test/issue42order/issue42.pb.go @@ -45,8 +45,7 @@ func (m *UnorderedFields) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_UnorderedFields.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -100,8 +99,7 @@ func (m *OrderedFields) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_OrderedFields.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue449/issue449.pb.go b/test/issue449/issue449.pb.go index 60b8cd3bd0..ec2f398683 100644 --- a/test/issue449/issue449.pb.go +++ b/test/issue449/issue449.pb.go @@ -48,8 +48,7 @@ func (m *CodeGenMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeGenMsg.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue498/issue498.pb.go b/test/issue498/issue498.pb.go index 2a1d170b84..f2813a694b 100644 --- a/test/issue498/issue498.pb.go +++ b/test/issue498/issue498.pb.go @@ -48,8 +48,7 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Message.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue503/issue503.pb.go b/test/issue503/issue503.pb.go index c7cdc8ccf9..62d74280f5 100644 --- a/test/issue503/issue503.pb.go +++ b/test/issue503/issue503.pb.go @@ -47,8 +47,7 @@ func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Foo.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue530/issue530.pb.go b/test/issue530/issue530.pb.go index ba07be2eed..9c6adaf247 100644 --- a/test/issue530/issue530.pb.go +++ b/test/issue530/issue530.pb.go @@ -53,8 +53,7 @@ func (m *Foo5) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Foo5.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -173,8 +172,7 @@ func (m *Bar1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar1.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -216,8 +214,7 @@ func (m *Bar2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar2.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -260,8 +257,7 @@ func (m *Bar3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar3.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -310,8 +306,7 @@ func (m *Bar4) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar4.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -354,8 +349,7 @@ func (m *Bar5) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar5.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -407,8 +401,7 @@ func (m *Bar7) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar7.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -471,8 +464,7 @@ func (m *Bar8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar8.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -515,8 +507,7 @@ func (m *Bar9) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Bar9.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/issue617/issue617.pb.go b/test/issue617/issue617.pb.go index b3a7744066..87f2224df7 100644 --- a/test/issue617/issue617.pb.go +++ b/test/issue617/issue617.pb.go @@ -45,8 +45,7 @@ func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Foo.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -117,8 +116,7 @@ func (m *Foo_Bar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Foo_Bar.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/mapdefaults/combos/both/map.pb.go b/test/mapdefaults/combos/both/map.pb.go index 713e34af36..4702207576 100644 --- a/test/mapdefaults/combos/both/map.pb.go +++ b/test/mapdefaults/combos/both/map.pb.go @@ -50,8 +50,7 @@ func (m *MapTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MapTest.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -89,8 +88,7 @@ func (m *FakeMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_FakeMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -130,8 +128,7 @@ func (m *FakeMapEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_FakeMapEntry.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/mapdefaults/combos/marshaler/map.pb.go b/test/mapdefaults/combos/marshaler/map.pb.go index 0f2329b5d8..6525809656 100644 --- a/test/mapdefaults/combos/marshaler/map.pb.go +++ b/test/mapdefaults/combos/marshaler/map.pb.go @@ -49,8 +49,7 @@ func (m *MapTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MapTest.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -88,8 +87,7 @@ func (m *FakeMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_FakeMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -129,8 +127,7 @@ func (m *FakeMapEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_FakeMapEntry.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/mapsproto2/combos/both/mapsproto2.pb.go b/test/mapsproto2/combos/both/mapsproto2.pb.go index c8429dfcad..20183d944c 100644 --- a/test/mapsproto2/combos/both/mapsproto2.pb.go +++ b/test/mapsproto2/combos/both/mapsproto2.pb.go @@ -97,8 +97,7 @@ func (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -139,8 +138,7 @@ func (m *CustomMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CustomMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -194,8 +192,7 @@ func (m *AllMaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AllMaps.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -246,8 +243,7 @@ func (m *AllMapsOrdered) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *AllMapsOrdered) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/mapsproto2/combos/marshaler/mapsproto2.pb.go b/test/mapsproto2/combos/marshaler/mapsproto2.pb.go index 385035b470..da0a829528 100644 --- a/test/mapsproto2/combos/marshaler/mapsproto2.pb.go +++ b/test/mapsproto2/combos/marshaler/mapsproto2.pb.go @@ -96,8 +96,7 @@ func (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -138,8 +137,7 @@ func (m *CustomMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CustomMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -193,8 +191,7 @@ func (m *AllMaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AllMaps.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -245,8 +242,7 @@ func (m *AllMapsOrdered) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AllMapsOrdered.Unmarshal(m, b) } func (m *AllMapsOrdered) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/nopackage/nopackage.pb.go b/test/nopackage/nopackage.pb.go index 769fb0a81e..f78048cd88 100644 --- a/test/nopackage/nopackage.pb.go +++ b/test/nopackage/nopackage.pb.go @@ -43,8 +43,7 @@ func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_M.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/oneof/combos/both/one.pb.go b/test/oneof/combos/both/one.pb.go index ef827249d2..cfab77f64d 100644 --- a/test/oneof/combos/both/one.pb.go +++ b/test/oneof/combos/both/one.pb.go @@ -52,8 +52,7 @@ func (m *Subby) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Subby.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -108,8 +107,7 @@ func (m *AllTypesOneOf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_AllTypesOneOf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -372,8 +370,7 @@ func (m *TwoOneofs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TwoOneofs.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -526,8 +523,7 @@ func (m *CustomOneof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_CustomOneof.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/oneof/combos/marshaler/one.pb.go b/test/oneof/combos/marshaler/one.pb.go index 67848eaa3b..3cb484150f 100644 --- a/test/oneof/combos/marshaler/one.pb.go +++ b/test/oneof/combos/marshaler/one.pb.go @@ -51,8 +51,7 @@ func (m *Subby) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Subby.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -107,8 +106,7 @@ func (m *AllTypesOneOf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_AllTypesOneOf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -371,8 +369,7 @@ func (m *TwoOneofs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TwoOneofs.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -525,8 +522,7 @@ func (m *CustomOneof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_CustomOneof.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/oneof3/combos/both/one.pb.go b/test/oneof3/combos/both/one.pb.go index 4f526a5507..3628b66e00 100644 --- a/test/oneof3/combos/both/one.pb.go +++ b/test/oneof3/combos/both/one.pb.go @@ -50,8 +50,7 @@ func (m *Subby) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Subby.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -106,8 +105,7 @@ func (m *SampleOneOf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_SampleOneOf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/oneof3/combos/marshaler/one.pb.go b/test/oneof3/combos/marshaler/one.pb.go index e4947416d3..7aa9c45267 100644 --- a/test/oneof3/combos/marshaler/one.pb.go +++ b/test/oneof3/combos/marshaler/one.pb.go @@ -49,8 +49,7 @@ func (m *Subby) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Subby.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -105,8 +104,7 @@ func (m *SampleOneOf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_SampleOneOf.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/protobuffer/protobuffer.pb.go b/test/protobuffer/protobuffer.pb.go index ae8df3a673..a525ed35ab 100644 --- a/test/protobuffer/protobuffer.pb.go +++ b/test/protobuffer/protobuffer.pb.go @@ -89,8 +89,7 @@ func (m *PBuffMarshaler) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro if deterministic { return xxx_messageInfo_PBuffMarshaler.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/protosize/protosize.pb.go b/test/protosize/protosize.pb.go index fce29a490a..afe348b776 100644 --- a/test/protosize/protosize.pb.go +++ b/test/protosize/protosize.pb.go @@ -47,8 +47,7 @@ func (m *SizeMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_SizeMessage.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/required/requiredexample.pb.go b/test/required/requiredexample.pb.go index 280fb4a988..63e78aa2fa 100644 --- a/test/required/requiredexample.pb.go +++ b/test/required/requiredexample.pb.go @@ -47,8 +47,7 @@ func (m *RequiredExample) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_RequiredExample.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -122,8 +121,7 @@ func (m *NidOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NidOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -281,8 +279,7 @@ func (m *NinOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_NinOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -426,8 +423,7 @@ func (m *NestedNinOptNative) XXX_Marshal(b []byte, deterministic bool) ([]byte, if deterministic { return xxx_messageInfo_NestedNinOptNative.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/sizeunderscore/sizeunderscore.pb.go b/test/sizeunderscore/sizeunderscore.pb.go index f52b349cc1..2ff78eb691 100644 --- a/test/sizeunderscore/sizeunderscore.pb.go +++ b/test/sizeunderscore/sizeunderscore.pb.go @@ -46,8 +46,7 @@ func (m *SizeMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_SizeMessage.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/theproto3/combos/both/theproto3.pb.go b/test/theproto3/combos/both/theproto3.pb.go index e044a6278a..6c604f7ec0 100644 --- a/test/theproto3/combos/both/theproto3.pb.go +++ b/test/theproto3/combos/both/theproto3.pb.go @@ -116,8 +116,7 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Message.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -155,8 +154,7 @@ func (m *Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Nested.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -210,8 +208,7 @@ func (m *AllMaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AllMaps.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -262,8 +259,7 @@ func (m *AllMapsOrdered) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *AllMapsOrdered) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -302,8 +298,7 @@ func (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro if deterministic { return xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -341,8 +336,7 @@ func (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -381,8 +375,7 @@ func (m *Uint128Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_Uint128Pair.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -419,8 +412,7 @@ func (m *ContainsNestedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_ContainsNestedMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -458,8 +450,7 @@ func (m *ContainsNestedMap_NestedMap) XXX_Marshal(b []byte, deterministic bool) if deterministic { return xxx_messageInfo_ContainsNestedMap_NestedMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -497,8 +488,7 @@ func (m *NotPacked) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NotPacked.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/theproto3/combos/marshaler/theproto3.pb.go b/test/theproto3/combos/marshaler/theproto3.pb.go index 4feef58779..140348eaec 100644 --- a/test/theproto3/combos/marshaler/theproto3.pb.go +++ b/test/theproto3/combos/marshaler/theproto3.pb.go @@ -115,8 +115,7 @@ func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Message.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -154,8 +153,7 @@ func (m *Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Nested.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -209,8 +207,7 @@ func (m *AllMaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AllMaps.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -261,8 +258,7 @@ func (m *AllMapsOrdered) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AllMapsOrdered.Unmarshal(m, b) } func (m *AllMapsOrdered) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -301,8 +297,7 @@ func (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro if deterministic { return xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -340,8 +335,7 @@ func (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -380,8 +374,7 @@ func (m *Uint128Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_Uint128Pair.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -418,8 +411,7 @@ func (m *ContainsNestedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, e if deterministic { return xxx_messageInfo_ContainsNestedMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -457,8 +449,7 @@ func (m *ContainsNestedMap_NestedMap) XXX_Marshal(b []byte, deterministic bool) if deterministic { return xxx_messageInfo_ContainsNestedMap_NestedMap.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -496,8 +487,7 @@ func (m *NotPacked) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NotPacked.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/typedecl/typedecl.pb.go b/test/typedecl/typedecl.pb.go index 568661eeda..9c7abc3278 100644 --- a/test/typedecl/typedecl.pb.go +++ b/test/typedecl/typedecl.pb.go @@ -36,8 +36,7 @@ func (m *Dropped) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Dropped.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -83,8 +82,7 @@ func (m *DroppedWithoutGetters) XXX_Marshal(b []byte, deterministic bool) ([]byt if deterministic { return xxx_messageInfo_DroppedWithoutGetters.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -123,8 +121,7 @@ func (m *Kept) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Kept.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/typedecl_all/typedeclall.pb.go b/test/typedecl_all/typedeclall.pb.go index b140fb9649..9df55c7080 100644 --- a/test/typedecl_all/typedeclall.pb.go +++ b/test/typedecl_all/typedeclall.pb.go @@ -36,8 +36,7 @@ func (m *Dropped) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Dropped.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -83,8 +82,7 @@ func (m *DroppedWithoutGetters) XXX_Marshal(b []byte, deterministic bool) ([]byt if deterministic { return xxx_messageInfo_DroppedWithoutGetters.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -123,8 +121,7 @@ func (m *Kept) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Kept.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/types/combos/both/types.pb.go b/test/types/combos/both/types.pb.go index 1aa5d651eb..41001aba69 100644 --- a/test/types/combos/both/types.pb.go +++ b/test/types/combos/both/types.pb.go @@ -60,8 +60,7 @@ func (m *KnownTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_KnownTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -205,8 +204,7 @@ func (m *ProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -420,8 +418,7 @@ func (m *StdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -635,8 +632,7 @@ func (m *RepProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_RepProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -850,8 +846,7 @@ func (m *RepStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_RepStdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1065,8 +1060,7 @@ func (m *MapProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_MapProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1280,8 +1274,7 @@ func (m *MapStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_MapStdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1486,8 +1479,7 @@ func (m *OneofProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_OneofProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1693,8 +1685,7 @@ func (m *OneofStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_OneofStdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/types/combos/marshaler/types.pb.go b/test/types/combos/marshaler/types.pb.go index 7bf1f5a66a..c8c04ef301 100644 --- a/test/types/combos/marshaler/types.pb.go +++ b/test/types/combos/marshaler/types.pb.go @@ -59,8 +59,7 @@ func (m *KnownTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_KnownTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -204,8 +203,7 @@ func (m *ProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -419,8 +417,7 @@ func (m *StdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -634,8 +631,7 @@ func (m *RepProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_RepProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -849,8 +845,7 @@ func (m *RepStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_RepStdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1064,8 +1059,7 @@ func (m *MapProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_MapProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1279,8 +1273,7 @@ func (m *MapStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_MapStdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1485,8 +1478,7 @@ func (m *OneofProtoTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, err if deterministic { return xxx_messageInfo_OneofProtoTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -1692,8 +1684,7 @@ func (m *OneofStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_OneofStdTypes.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/unrecognized/unrecognized.pb.go b/test/unrecognized/unrecognized.pb.go index 4522459c70..2c5e278c70 100644 --- a/test/unrecognized/unrecognized.pb.go +++ b/test/unrecognized/unrecognized.pb.go @@ -50,8 +50,7 @@ func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_A.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -91,8 +90,7 @@ func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_B.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -130,8 +128,7 @@ func (m *D) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_D.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -174,8 +171,7 @@ func (m *C) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_C.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -213,8 +209,7 @@ func (m *U) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_U.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -282,8 +277,7 @@ func (m *OldA) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OldA.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -322,8 +316,7 @@ func (m *OldB) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OldB.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -365,8 +358,7 @@ func (m *OldC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OldC.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -405,8 +397,7 @@ func (m *OldU) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OldU.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/test/unrecognizedgroup/unrecognizedgroup.pb.go b/test/unrecognizedgroup/unrecognizedgroup.pb.go index 9bb6f20c9b..14b272b2f1 100644 --- a/test/unrecognizedgroup/unrecognizedgroup.pb.go +++ b/test/unrecognizedgroup/unrecognizedgroup.pb.go @@ -52,8 +52,7 @@ func (m *NewNoGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_NewNoGroup.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -91,8 +90,7 @@ func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_A.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/any.pb.go b/types/any.pb.go index 3074a3d8a0..e6c4f69dad 100644 --- a/types/any.pb.go +++ b/types/any.pb.go @@ -155,8 +155,7 @@ func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Any.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/api.pb.go b/types/api.pb.go index 61612e21a8..61866a8b2f 100644 --- a/types/api.pb.go +++ b/types/api.pb.go @@ -88,8 +88,7 @@ func (m *Api) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Api.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -194,8 +193,7 @@ func (m *Method) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Method.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -368,8 +366,7 @@ func (m *Mixin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Mixin.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/duration.pb.go b/types/duration.pb.go index 32b957c2bd..7a624bf93f 100644 --- a/types/duration.pb.go +++ b/types/duration.pb.go @@ -115,8 +115,7 @@ func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Duration.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/empty.pb.go b/types/empty.pb.go index b061be5e4b..f5e66aae10 100644 --- a/types/empty.pb.go +++ b/types/empty.pb.go @@ -53,8 +53,7 @@ func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Empty.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/field_mask.pb.go b/types/field_mask.pb.go index 61ef57e2ca..8061fa14ab 100644 --- a/types/field_mask.pb.go +++ b/types/field_mask.pb.go @@ -244,8 +244,7 @@ func (m *FieldMask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_FieldMask.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/source_context.pb.go b/types/source_context.pb.go index 9b0752ed50..b90f49788d 100644 --- a/types/source_context.pb.go +++ b/types/source_context.pb.go @@ -48,8 +48,7 @@ func (m *SourceContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error if deterministic { return xxx_messageInfo_SourceContext.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/struct.pb.go b/types/struct.pb.go index deffae83ab..7c87a085e0 100644 --- a/types/struct.pb.go +++ b/types/struct.pb.go @@ -82,8 +82,7 @@ func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Struct.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -148,8 +147,7 @@ func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Value.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -291,8 +289,7 @@ func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ListValue.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/timestamp.pb.go b/types/timestamp.pb.go index bdbfe18c7b..c02ba2aa18 100644 --- a/types/timestamp.pb.go +++ b/types/timestamp.pb.go @@ -137,8 +137,7 @@ func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/type.pb.go b/types/type.pb.go index a3a4f354e9..f251ae77ec 100644 --- a/types/type.pb.go +++ b/types/type.pb.go @@ -205,8 +205,7 @@ func (m *Type) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Type.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -312,8 +311,7 @@ func (m *Field) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Field.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -435,8 +433,7 @@ func (m *Enum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Enum.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -519,8 +516,7 @@ func (m *EnumValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_EnumValue.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -594,8 +590,7 @@ func (m *Option) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Option.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/types/wrappers.pb.go b/types/wrappers.pb.go index 5628dffa40..34dfc61d13 100644 --- a/types/wrappers.pb.go +++ b/types/wrappers.pb.go @@ -50,8 +50,7 @@ func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -105,8 +104,7 @@ func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -160,8 +158,7 @@ func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -215,8 +212,7 @@ func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -270,8 +266,7 @@ func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -325,8 +320,7 @@ func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -380,8 +374,7 @@ func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -435,8 +428,7 @@ func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) if deterministic { return xxx_messageInfo_StringValue.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } @@ -490,8 +482,7 @@ func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/fast/gogovanity.pb.go b/vanity/test/fast/gogovanity.pb.go index b55a07177b..3b77e8a042 100644 --- a/vanity/test/fast/gogovanity.pb.go +++ b/vanity/test/fast/gogovanity.pb.go @@ -45,8 +45,7 @@ func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_B.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/fast/proto3.pb.go b/vanity/test/fast/proto3.pb.go index 94252ac382..e3b366132c 100644 --- a/vanity/test/fast/proto3.pb.go +++ b/vanity/test/fast/proto3.pb.go @@ -42,8 +42,7 @@ func (m *Aproto3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Aproto3.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/fast/vanity.pb.go b/vanity/test/fast/vanity.pb.go index 0bc25790d7..df47b8fa79 100644 --- a/vanity/test/fast/vanity.pb.go +++ b/vanity/test/fast/vanity.pb.go @@ -44,8 +44,7 @@ func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_A.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/faster/gogovanity.pb.go b/vanity/test/faster/gogovanity.pb.go index 67a01b30b6..e87759b7e4 100644 --- a/vanity/test/faster/gogovanity.pb.go +++ b/vanity/test/faster/gogovanity.pb.go @@ -42,8 +42,7 @@ func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_B.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/faster/proto3.pb.go b/vanity/test/faster/proto3.pb.go index 6f6e54d810..46df27bc22 100644 --- a/vanity/test/faster/proto3.pb.go +++ b/vanity/test/faster/proto3.pb.go @@ -39,8 +39,7 @@ func (m *Aproto3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Aproto3.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/faster/vanity.pb.go b/vanity/test/faster/vanity.pb.go index ea93803c9c..b4707644d4 100644 --- a/vanity/test/faster/vanity.pb.go +++ b/vanity/test/faster/vanity.pb.go @@ -41,8 +41,7 @@ func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_A.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/slick/gogovanity.pb.go b/vanity/test/slick/gogovanity.pb.go index 003aa3fd2e..4c9cfc17d8 100644 --- a/vanity/test/slick/gogovanity.pb.go +++ b/vanity/test/slick/gogovanity.pb.go @@ -43,8 +43,7 @@ func (m *B) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_B.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/slick/proto3.pb.go b/vanity/test/slick/proto3.pb.go index 6c5e00bea3..c2a132a64f 100644 --- a/vanity/test/slick/proto3.pb.go +++ b/vanity/test/slick/proto3.pb.go @@ -40,8 +40,7 @@ func (m *Aproto3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Aproto3.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err } diff --git a/vanity/test/slick/vanity.pb.go b/vanity/test/slick/vanity.pb.go index 7c17b39094..69a2ba41f7 100644 --- a/vanity/test/slick/vanity.pb.go +++ b/vanity/test/slick/vanity.pb.go @@ -42,8 +42,7 @@ func (m *A) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_A.Marshal(b, m, deterministic) } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) + n, err := m.MarshalTo(b) if err != nil { return nil, err }