From abdee0e668e0478223bceaffd4e2890ff9a28449 Mon Sep 17 00:00:00 2001 From: Patrick Stephen Date: Fri, 10 Nov 2023 06:08:33 -0600 Subject: [PATCH] testdata: regenerate --- .../array_of_strings.go | 2 +- testdata/generated-always-pointers/arrays.go | 18 +-- .../generated-always-pointers/basic_arrays.go | 12 +- .../generated-always-pointers/basic_types.go | 2 +- .../generated-always-pointers/bench_test.go | 84 ++++++++++++++ testdata/generated-always-pointers/date.go | 4 +- .../documentation.go | 10 +- testdata/generated-always-pointers/foo.go | 18 +-- testdata/generated-always-pointers/jazz.go | 32 ++++-- testdata/generated-always-pointers/lab.go | 78 +++++++------ .../generated-always-pointers/map_types.go | 32 ++++-- .../generated-always-pointers/message_1.go | 4 +- .../generated-always-pointers/message_map.go | 4 +- .../msgpack_comparison.go | 2 +- testdata/generated-always-pointers/request.go | 20 ++-- testdata/generated-always-pointers/server.go | 38 ++++--- testdata/generated-always-pointers/tags.go | 26 +++-- .../generated-always-pointers/typed_enums.go | 2 +- testdata/generated-always-pointers/union.go | 102 ++++++++++------- .../generated-always-pointers/union_field.go | 52 +++++---- .../generated-private/array_of_strings.go | 2 +- testdata/generated-private/arrays.go | 2 +- testdata/generated-private/basic_arrays.go | 4 +- testdata/generated-private/basic_types.go | 2 +- testdata/generated-private/date.go | 4 +- testdata/generated-private/documentation.go | 10 +- testdata/generated-private/foo.go | 18 +-- testdata/generated-private/jazz.go | 32 ++++-- testdata/generated-private/lab.go | 70 +++++++----- testdata/generated-private/map_types.go | 32 ++++-- testdata/generated-private/message_1.go | 4 +- testdata/generated-private/message_map.go | 4 +- .../generated-private/msgpack_comparison.go | 2 +- testdata/generated-private/request.go | 20 ++-- testdata/generated-private/server.go | 38 ++++--- testdata/generated-private/tags.go | 26 +++-- testdata/generated-private/typed_enums.go | 2 +- testdata/generated-private/union.go | 102 ++++++++++------- testdata/generated-private/union_field.go | 52 +++++---- testdata/generated/array_of_strings.go | 2 +- testdata/generated/arrays.go | 2 +- testdata/generated/basic_arrays.go | 4 +- testdata/generated/basic_types.go | 2 +- testdata/generated/bench_test.go | 84 ++++++++++++++ testdata/generated/date.go | 4 +- testdata/generated/documentation.go | 10 +- testdata/generated/foo.go | 18 +-- testdata/generated/import_b/import_b.go | 106 +++++++++++------- testdata/generated/jazz.go | 32 ++++-- testdata/generated/lab.go | 70 +++++++----- testdata/generated/map_types.go | 32 ++++-- testdata/generated/message_1.go | 4 +- testdata/generated/message_map.go | 4 +- testdata/generated/msgpack_comparison.go | 2 +- testdata/generated/quoted_string.go | 2 +- testdata/generated/request.go | 20 ++-- testdata/generated/server.go | 38 ++++--- testdata/generated/tags.go | 26 +++-- testdata/generated/typed_enums.go | 2 +- testdata/generated/union.go | 102 ++++++++++------- testdata/generated/union_field.go | 52 +++++---- .../generated/import_separate_a.go | 68 ++++++----- .../generatedthree/import_separate_c.go | 2 +- .../generatedtwo/import_separate_b.go | 68 ++++++----- 64 files changed, 1090 insertions(+), 634 deletions(-) create mode 100644 testdata/generated-always-pointers/bench_test.go create mode 100644 testdata/generated/bench_test.go diff --git a/testdata/generated-always-pointers/array_of_strings.go b/testdata/generated-always-pointers/array_of_strings.go index 6f53b75..6cc7279 100644 --- a/testdata/generated-always-pointers/array_of_strings.go +++ b/testdata/generated-always-pointers/array_of_strings.go @@ -87,7 +87,7 @@ func (bbp *ArrayOfStrings) MarshalBebop() []byte { return buf } -func MakeArrayOfStrings(r iohelp.ErrorReader) (ArrayOfStrings, error) { +func MakeArrayOfStrings(r *iohelp.ErrorReader) (ArrayOfStrings, error) { v := ArrayOfStrings{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/arrays.go b/testdata/generated-always-pointers/arrays.go index d3f1968..24a12e8 100644 --- a/testdata/generated-always-pointers/arrays.go +++ b/testdata/generated-always-pointers/arrays.go @@ -132,9 +132,7 @@ func (bbp *ArraySamples) EncodeBebop(iow io.Writer) (err error) { iohelp.WriteUint32(w, uint32(len(elem))) for _, elem := range elem { iohelp.WriteUint32(w, uint32(len(elem))) - for _, elem := range elem { - iohelp.WriteByte(w, elem) - } + w.Write(elem) } } iohelp.WriteUint32(w, uint32(len(bbp.Bytes2))) @@ -142,9 +140,7 @@ func (bbp *ArraySamples) EncodeBebop(iow io.Writer) (err error) { iohelp.WriteUint32(w, uint32(len(elem))) for _, elem := range elem { iohelp.WriteUint32(w, uint32(len(elem))) - for _, elem := range elem { - iohelp.WriteByte(w, elem) - } + w.Write(elem) } } return w.Err @@ -157,9 +153,7 @@ func (bbp *ArraySamples) DecodeBebop(ior io.Reader) (err error) { (bbp.Bytes[i1]) = make([][]byte, iohelp.ReadUint32(r)) for i2 := range (bbp.Bytes[i1]) { ((bbp.Bytes[i1])[i2]) = make([]byte, iohelp.ReadUint32(r)) - for i3 := range ((bbp.Bytes[i1])[i2]) { - (((bbp.Bytes[i1])[i2])[i3]) = iohelp.ReadByte(r) - } + r.Read(((bbp.Bytes[i1])[i2])) } } bbp.Bytes2 = make([][][]byte, iohelp.ReadUint32(r)) @@ -167,9 +161,7 @@ func (bbp *ArraySamples) DecodeBebop(ior io.Reader) (err error) { (bbp.Bytes2[i1]) = make([][]byte, iohelp.ReadUint32(r)) for i2 := range (bbp.Bytes2[i1]) { ((bbp.Bytes2[i1])[i2]) = make([]byte, iohelp.ReadUint32(r)) - for i3 := range ((bbp.Bytes2[i1])[i2]) { - (((bbp.Bytes2[i1])[i2])[i3]) = iohelp.ReadByte(r) - } + r.Read(((bbp.Bytes2[i1])[i2])) } } return r.Err @@ -202,7 +194,7 @@ func (bbp *ArraySamples) MarshalBebop() []byte { return buf } -func MakeArraySamples(r iohelp.ErrorReader) (ArraySamples, error) { +func MakeArraySamples(r *iohelp.ErrorReader) (ArraySamples, error) { v := ArraySamples{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/basic_arrays.go b/testdata/generated-always-pointers/basic_arrays.go index 4f5aea1..e11d225 100644 --- a/testdata/generated-always-pointers/basic_arrays.go +++ b/testdata/generated-always-pointers/basic_arrays.go @@ -329,9 +329,7 @@ func (bbp *BasicArrays) EncodeBebop(iow io.Writer) (err error) { iohelp.WriteBool(w, elem) } iohelp.WriteUint32(w, uint32(len(bbp.A_byte))) - for _, elem := range bbp.A_byte { - iohelp.WriteByte(w, elem) - } + w.Write(bbp.A_byte) iohelp.WriteUint32(w, uint32(len(bbp.A_int16))) for _, elem := range bbp.A_int16 { iohelp.WriteInt16(w, elem) @@ -383,9 +381,7 @@ func (bbp *BasicArrays) DecodeBebop(ior io.Reader) (err error) { (bbp.A_bool[i1]) = iohelp.ReadBool(r) } bbp.A_byte = make([]byte, iohelp.ReadUint32(r)) - for i1 := range bbp.A_byte { - (bbp.A_byte[i1]) = iohelp.ReadByte(r) - } + r.Read(bbp.A_byte) bbp.A_int16 = make([]int16, iohelp.ReadUint32(r)) for i1 := range bbp.A_int16 { (bbp.A_int16[i1]) = iohelp.ReadInt16(r) @@ -466,7 +462,7 @@ func (bbp *BasicArrays) MarshalBebop() []byte { return buf } -func MakeBasicArrays(r iohelp.ErrorReader) (BasicArrays, error) { +func MakeBasicArrays(r *iohelp.ErrorReader) (BasicArrays, error) { v := BasicArrays{} err := v.DecodeBebop(r) return v, err @@ -559,7 +555,7 @@ func (bbp *TestInt32Array) MarshalBebop() []byte { return buf } -func MakeTestInt32Array(r iohelp.ErrorReader) (TestInt32Array, error) { +func MakeTestInt32Array(r *iohelp.ErrorReader) (TestInt32Array, error) { v := TestInt32Array{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/basic_types.go b/testdata/generated-always-pointers/basic_types.go index 85cda76..fddfa47 100644 --- a/testdata/generated-always-pointers/basic_types.go +++ b/testdata/generated-always-pointers/basic_types.go @@ -228,7 +228,7 @@ func (bbp *BasicTypes) MarshalBebop() []byte { return buf } -func MakeBasicTypes(r iohelp.ErrorReader) (BasicTypes, error) { +func MakeBasicTypes(r *iohelp.ErrorReader) (BasicTypes, error) { v := BasicTypes{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/bench_test.go b/testdata/generated-always-pointers/bench_test.go new file mode 100644 index 0000000..9301596 --- /dev/null +++ b/testdata/generated-always-pointers/bench_test.go @@ -0,0 +1,84 @@ +package generated_test + +import ( + "bytes" + "math/rand" + "testing" + + "github.com/200sc/bebop/testdata/generated" +) + +func BenchmarkArraySamplesMarshalBebopTo(b *testing.B) { + b.StopTimer() + b1 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b1[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b1[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b1[i][j][k] = byte(rand.Intn(255)) + } + } + } + b2 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b2[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b2[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b2[i][j][k] = byte(rand.Intn(255)) + } + } + } + v := generated.ArraySamples{ + Bytes: b1, + Bytes2: b2, + } + out := make([]byte, v.Size()) + + b.ReportAllocs() + b.StartTimer() + for i := 0; i < b.N; i++ { + v.MarshalBebopTo(out) + } + benchOut = out +} + +var benchOut []byte + +func BenchmarkArraySamplesEncodeBebop(b *testing.B) { + b.StopTimer() + b1 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b1[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b1[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b1[i][j][k] = byte(rand.Intn(255)) + } + } + } + b2 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b2[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b2[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b2[i][j][k] = byte(rand.Intn(255)) + } + } + } + v := generated.ArraySamples{ + Bytes: b1, + Bytes2: b2, + } + + w := bytes.NewBuffer(make([]byte, 0, v.Size())) + + b.ReportAllocs() + b.StartTimer() + for i := 0; i < b.N; i++ { + v.EncodeBebop(w) + } + benchOut = w.Bytes() +} diff --git a/testdata/generated-always-pointers/date.go b/testdata/generated-always-pointers/date.go index 488e6ad..11dfd24 100644 --- a/testdata/generated-always-pointers/date.go +++ b/testdata/generated-always-pointers/date.go @@ -129,7 +129,7 @@ func (bbp *MyObj) DecodeBebop(ior io.Reader) (err error) { bbp.End = new(time.Time) *bbp.End = iohelp.ReadDate(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -154,7 +154,7 @@ func (bbp *MyObj) MarshalBebop() []byte { return buf } -func MakeMyObj(r iohelp.ErrorReader) (MyObj, error) { +func MakeMyObj(r *iohelp.ErrorReader) (MyObj, error) { v := MyObj{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/documentation.go b/testdata/generated-always-pointers/documentation.go index a6b068d..8b98bbc 100644 --- a/testdata/generated-always-pointers/documentation.go +++ b/testdata/generated-always-pointers/documentation.go @@ -83,7 +83,7 @@ func (bbp *DocS) MarshalBebop() []byte { return buf } -func MakeDocS(r iohelp.ErrorReader) (DocS, error) { +func MakeDocS(r *iohelp.ErrorReader) (DocS, error) { v := DocS{} err := v.DecodeBebop(r) return v, err @@ -169,7 +169,7 @@ func (bbp *DepM) DecodeBebop(ior io.Reader) (err error) { bbp.X = new(int32) *bbp.X = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -186,7 +186,7 @@ func (bbp *DepM) MarshalBebop() []byte { return buf } -func MakeDepM(r iohelp.ErrorReader) (DepM, error) { +func MakeDepM(r *iohelp.ErrorReader) (DepM, error) { v := DepM{} err := v.DecodeBebop(r) return v, err @@ -320,7 +320,7 @@ func (bbp *DocM) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(int32) *bbp.Z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -341,7 +341,7 @@ func (bbp *DocM) MarshalBebop() []byte { return buf } -func MakeDocM(r iohelp.ErrorReader) (DocM, error) { +func MakeDocM(r *iohelp.ErrorReader) (DocM, error) { v := DocM{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/foo.go b/testdata/generated-always-pointers/foo.go index 0e05315..10a35df 100644 --- a/testdata/generated-always-pointers/foo.go +++ b/testdata/generated-always-pointers/foo.go @@ -17,7 +17,8 @@ type Foo struct { func (bbp *Foo) MarshalBebopTo(buf []byte) int { at := 0 (bbp.Bar).MarshalBebopTo(buf[at:]) - tmp3300 := (bbp.Bar); at += tmp3300.Size() + tmp := (bbp.Bar) + at += tmp.Size() return at } @@ -27,14 +28,16 @@ func (bbp *Foo) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3313 := (bbp.Bar); at += tmp3313.Size() + tmp := (bbp.Bar) + at += tmp.Size() return nil } func (bbp *Foo) MustUnmarshalBebop(buf []byte) { at := 0 bbp.Bar = MustMakeBarFromBytes(buf[at:]) - tmp3321 := (bbp.Bar); at += tmp3321.Size() + tmp := (bbp.Bar) + at += tmp.Size() } func (bbp *Foo) EncodeBebop(iow io.Writer) (err error) { @@ -57,7 +60,8 @@ func (bbp *Foo) DecodeBebop(ior io.Reader) (err error) { func (bbp *Foo) Size() int { bodyLen := 0 - tmp3355 := (bbp.Bar); bodyLen += tmp3355.Size() + tmp := (bbp.Bar) + bodyLen += tmp.Size() return bodyLen } @@ -67,7 +71,7 @@ func (bbp *Foo) MarshalBebop() []byte { return buf } -func MakeFoo(r iohelp.ErrorReader) (Foo, error) { +func MakeFoo(r *iohelp.ErrorReader) (Foo, error) { v := Foo{} err := v.DecodeBebop(r) return v, err @@ -216,7 +220,7 @@ func (bbp *Bar) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(float64) *bbp.Z = iohelp.ReadFloat64(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -245,7 +249,7 @@ func (bbp *Bar) MarshalBebop() []byte { return buf } -func MakeBar(r iohelp.ErrorReader) (Bar, error) { +func MakeBar(r *iohelp.ErrorReader) (Bar, error) { v := Bar{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/jazz.go b/testdata/generated-always-pointers/jazz.go index 148fbd7..e297110 100644 --- a/testdata/generated-always-pointers/jazz.go +++ b/testdata/generated-always-pointers/jazz.go @@ -81,7 +81,7 @@ func (bbp *Musician) MarshalBebop() []byte { return buf } -func MakeMusician(r iohelp.ErrorReader) (Musician, error) { +func MakeMusician(r *iohelp.ErrorReader) (Musician, error) { v := Musician{} err := v.DecodeBebop(r) return v, err @@ -131,7 +131,8 @@ func (bbp *Library) MarshalBebopTo(buf []byte) int { iohelp.WriteGUIDBytes(buf[at:], k1) at += 16 (v1).MarshalBebopTo(buf[at:]) - tmp3357 := (v1); at += tmp3357.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -151,7 +152,8 @@ func (bbp *Library) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3380 := ((bbp.Songs)[k1]); at += tmp3380.Size() + tmp := ((bbp.Songs)[k1]) + at += tmp.Size() } return nil } @@ -165,7 +167,8 @@ func (bbp *Library) MustUnmarshalBebop(buf []byte) { k1 := iohelp.ReadGUIDBytes(buf[at:]) at += 16 (bbp.Songs)[k1] = MustMakeSongFromBytes(buf[at:]) - tmp3391 := ((bbp.Songs)[k1]); at += tmp3391.Size() + tmp := ((bbp.Songs)[k1]) + at += tmp.Size() } } @@ -201,7 +204,8 @@ func (bbp *Library) Size() int { bodyLen += 4 for _, v1 := range bbp.Songs { bodyLen += 16 - tmp3446 := (v1); bodyLen += tmp3446.Size() + tmp := (v1) + bodyLen += tmp.Size() } return bodyLen } @@ -212,7 +216,7 @@ func (bbp *Library) MarshalBebop() []byte { return buf } -func MakeLibrary(r iohelp.ErrorReader) (Library, error) { +func MakeLibrary(r *iohelp.ErrorReader) (Library, error) { v := Library{} err := v.DecodeBebop(r) return v, err @@ -262,7 +266,8 @@ func (bbp *Song) MarshalBebopTo(buf []byte) int { at += 4 for _, v2 := range *bbp.Performers { (v2).MarshalBebopTo(buf[at:]) - tmp3530 := (v2); at += tmp3530.Size() + tmp := (v2) + at += tmp.Size() } } return at @@ -303,7 +308,8 @@ func (bbp *Song) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3564 := (((*bbp.Performers))[i3]); at += tmp3564.Size() + tmp := (((*bbp.Performers))[i3]) + at += tmp.Size() } default: return nil @@ -334,7 +340,8 @@ func (bbp *Song) MustUnmarshalBebop(buf []byte) { at += 4 for i3 := range (*bbp.Performers) { ((*bbp.Performers))[i3] = MustMakeMusicianFromBytes(buf[at:]) - tmp3611 := (((*bbp.Performers))[i3]); at += tmp3611.Size() + tmp := (((*bbp.Performers))[i3]) + at += tmp.Size() } default: return @@ -390,7 +397,7 @@ func (bbp *Song) DecodeBebop(ior io.Reader) (err error) { } } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -410,7 +417,8 @@ func (bbp *Song) Size() int { bodyLen += 1 bodyLen += 4 for _, elem := range *bbp.Performers { - tmp3759 := (elem); bodyLen += tmp3759.Size() + tmp := (elem) + bodyLen += tmp.Size() } } return bodyLen @@ -422,7 +430,7 @@ func (bbp *Song) MarshalBebop() []byte { return buf } -func MakeSong(r iohelp.ErrorReader) (Song, error) { +func MakeSong(r *iohelp.ErrorReader) (Song, error) { v := Song{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/lab.go b/testdata/generated-always-pointers/lab.go index 41e5dfb..94cf220 100644 --- a/testdata/generated-always-pointers/lab.go +++ b/testdata/generated-always-pointers/lab.go @@ -90,7 +90,7 @@ func (bbp *Int32s) MarshalBebop() []byte { return buf } -func MakeInt32s(r iohelp.ErrorReader) (Int32s, error) { +func MakeInt32s(r *iohelp.ErrorReader) (Int32s, error) { v := Int32s{} err := v.DecodeBebop(r) return v, err @@ -183,7 +183,7 @@ func (bbp *Uint32s) MarshalBebop() []byte { return buf } -func MakeUint32s(r iohelp.ErrorReader) (Uint32s, error) { +func MakeUint32s(r *iohelp.ErrorReader) (Uint32s, error) { v := Uint32s{} err := v.DecodeBebop(r) return v, err @@ -276,7 +276,7 @@ func (bbp *Float32s) MarshalBebop() []byte { return buf } -func MakeFloat32s(r iohelp.ErrorReader) (Float32s, error) { +func MakeFloat32s(r *iohelp.ErrorReader) (Float32s, error) { v := Float32s{} err := v.DecodeBebop(r) return v, err @@ -369,7 +369,7 @@ func (bbp *Int64s) MarshalBebop() []byte { return buf } -func MakeInt64s(r iohelp.ErrorReader) (Int64s, error) { +func MakeInt64s(r *iohelp.ErrorReader) (Int64s, error) { v := Int64s{} err := v.DecodeBebop(r) return v, err @@ -462,7 +462,7 @@ func (bbp *Uint64s) MarshalBebop() []byte { return buf } -func MakeUint64s(r iohelp.ErrorReader) (Uint64s, error) { +func MakeUint64s(r *iohelp.ErrorReader) (Uint64s, error) { v := Uint64s{} err := v.DecodeBebop(r) return v, err @@ -555,7 +555,7 @@ func (bbp *Float64s) MarshalBebop() []byte { return buf } -func MakeFloat64s(r iohelp.ErrorReader) (Float64s, error) { +func MakeFloat64s(r *iohelp.ErrorReader) (Float64s, error) { v := Float64s{} err := v.DecodeBebop(r) return v, err @@ -647,9 +647,7 @@ func (bbp *VideoData) EncodeBebop(iow io.Writer) (err error) { iohelp.WriteUint32(w, bbp.Width) iohelp.WriteUint32(w, bbp.Height) iohelp.WriteUint32(w, uint32(len(bbp.Fragment))) - for _, elem := range bbp.Fragment { - iohelp.WriteByte(w, elem) - } + w.Write(bbp.Fragment) return w.Err } @@ -659,9 +657,7 @@ func (bbp *VideoData) DecodeBebop(ior io.Reader) (err error) { bbp.Width = iohelp.ReadUint32(r) bbp.Height = iohelp.ReadUint32(r) bbp.Fragment = make([]byte, iohelp.ReadUint32(r)) - for i1 := range bbp.Fragment { - (bbp.Fragment[i1]) = iohelp.ReadByte(r) - } + r.Read(bbp.Fragment) return r.Err } @@ -681,7 +677,7 @@ func (bbp *VideoData) MarshalBebop() []byte { return buf } -func MakeVideoData(r iohelp.ErrorReader) (VideoData, error) { +func MakeVideoData(r *iohelp.ErrorReader) (VideoData, error) { v := VideoData{} err := v.DecodeBebop(r) return v, err @@ -720,7 +716,8 @@ func (bbp *MediaMessage) MarshalBebopTo(buf []byte) int { buf[at] = 2 at++ (*bbp.Data).MarshalBebopTo(buf[at:]) - tmp4692 := (*bbp.Data); at += tmp4692.Size() + tmp := (*bbp.Data) + at += tmp.Size() } return at } @@ -743,7 +740,8 @@ func (bbp *MediaMessage) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp4725 := ((*bbp.Data)); at += tmp4725.Size() + tmp := ((*bbp.Data)) + at += tmp.Size() default: return nil } @@ -765,7 +763,8 @@ func (bbp *MediaMessage) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Data = new(VideoData) (*bbp.Data) = MustMakeVideoDataFromBytes(buf[at:]) - tmp4745 := ((*bbp.Data)); at += tmp4745.Size() + tmp := ((*bbp.Data)) + at += tmp.Size() default: return } @@ -806,7 +805,7 @@ func (bbp *MediaMessage) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -820,7 +819,8 @@ func (bbp *MediaMessage) Size() int { } if bbp.Data != nil { bodyLen += 1 - tmp4874 := (*bbp.Data); bodyLen += tmp4874.Size() + tmp := (*bbp.Data) + bodyLen += tmp.Size() } return bodyLen } @@ -831,7 +831,7 @@ func (bbp *MediaMessage) MarshalBebop() []byte { return buf } -func MakeMediaMessage(r iohelp.ErrorReader) (MediaMessage, error) { +func MakeMediaMessage(r *iohelp.ErrorReader) (MediaMessage, error) { v := MediaMessage{} err := v.DecodeBebop(r) return v, err @@ -954,7 +954,7 @@ func (bbp *SkipTestOld) DecodeBebop(ior io.Reader) (err error) { bbp.Y = new(int32) *bbp.Y = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -979,7 +979,7 @@ func (bbp *SkipTestOld) MarshalBebop() []byte { return buf } -func MakeSkipTestOld(r iohelp.ErrorReader) (SkipTestOld, error) { +func MakeSkipTestOld(r *iohelp.ErrorReader) (SkipTestOld, error) { v := SkipTestOld{} err := v.DecodeBebop(r) return v, err @@ -1128,7 +1128,7 @@ func (bbp *SkipTestNew) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(int32) *bbp.Z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1157,7 +1157,7 @@ func (bbp *SkipTestNew) MarshalBebop() []byte { return buf } -func MakeSkipTestNew(r iohelp.ErrorReader) (SkipTestNew, error) { +func MakeSkipTestNew(r *iohelp.ErrorReader) (SkipTestNew, error) { v := SkipTestNew{} err := v.DecodeBebop(r) return v, err @@ -1190,7 +1190,8 @@ func (bbp *SkipTestOldContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.S).MarshalBebopTo(buf[at:]) - tmp5126 := (*bbp.S); at += tmp5126.Size() + tmp := (*bbp.S) + at += tmp.Size() } if bbp.After != nil { buf[at] = 2 @@ -1214,7 +1215,8 @@ func (bbp *SkipTestOldContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5133 := ((*bbp.S)); at += tmp5133.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1239,7 +1241,8 @@ func (bbp *SkipTestOldContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.S = new(SkipTestOld) (*bbp.S) = MustMakeSkipTestOldFromBytes(buf[at:]) - tmp5138 := ((*bbp.S)); at += tmp5138.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1285,7 +1288,7 @@ func (bbp *SkipTestOldContainer) DecodeBebop(ior io.Reader) (err error) { bbp.After = new(int32) *bbp.After = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1295,7 +1298,8 @@ func (bbp *SkipTestOldContainer) Size() int { bodyLen := 5 if bbp.S != nil { bodyLen += 1 - tmp5152 := (*bbp.S); bodyLen += tmp5152.Size() + tmp := (*bbp.S) + bodyLen += tmp.Size() } if bbp.After != nil { bodyLen += 1 @@ -1310,7 +1314,7 @@ func (bbp *SkipTestOldContainer) MarshalBebop() []byte { return buf } -func MakeSkipTestOldContainer(r iohelp.ErrorReader) (SkipTestOldContainer, error) { +func MakeSkipTestOldContainer(r *iohelp.ErrorReader) (SkipTestOldContainer, error) { v := SkipTestOldContainer{} err := v.DecodeBebop(r) return v, err @@ -1343,7 +1347,8 @@ func (bbp *SkipTestNewContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.S).MarshalBebopTo(buf[at:]) - tmp5161 := (*bbp.S); at += tmp5161.Size() + tmp := (*bbp.S) + at += tmp.Size() } if bbp.After != nil { buf[at] = 2 @@ -1367,7 +1372,8 @@ func (bbp *SkipTestNewContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5168 := ((*bbp.S)); at += tmp5168.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1392,7 +1398,8 @@ func (bbp *SkipTestNewContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.S = new(SkipTestNew) (*bbp.S) = MustMakeSkipTestNewFromBytes(buf[at:]) - tmp5173 := ((*bbp.S)); at += tmp5173.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1438,7 +1445,7 @@ func (bbp *SkipTestNewContainer) DecodeBebop(ior io.Reader) (err error) { bbp.After = new(int32) *bbp.After = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1448,7 +1455,8 @@ func (bbp *SkipTestNewContainer) Size() int { bodyLen := 5 if bbp.S != nil { bodyLen += 1 - tmp5205 := (*bbp.S); bodyLen += tmp5205.Size() + tmp := (*bbp.S) + bodyLen += tmp.Size() } if bbp.After != nil { bodyLen += 1 @@ -1463,7 +1471,7 @@ func (bbp *SkipTestNewContainer) MarshalBebop() []byte { return buf } -func MakeSkipTestNewContainer(r iohelp.ErrorReader) (SkipTestNewContainer, error) { +func MakeSkipTestNewContainer(r *iohelp.ErrorReader) (SkipTestNewContainer, error) { v := SkipTestNewContainer{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/map_types.go b/testdata/generated-always-pointers/map_types.go index 7b0d745..c8a4cd9 100644 --- a/testdata/generated-always-pointers/map_types.go +++ b/testdata/generated-always-pointers/map_types.go @@ -74,7 +74,7 @@ func (bbp *S) MarshalBebop() []byte { return buf } -func MakeS(r iohelp.ErrorReader) (S, error) { +func MakeS(r *iohelp.ErrorReader) (S, error) { v := S{} err := v.DecodeBebop(r) return v, err @@ -164,7 +164,8 @@ func (bbp *SomeMaps) MarshalBebopTo(buf []byte) int { iohelp.WriteBoolBytes(buf[at:], k4) at += 1 (v4).MarshalBebopTo(buf[at:]) - tmp3575 := (v4); at += tmp3575.Size() + tmp := (v4) + at += tmp.Size() } } } @@ -192,7 +193,8 @@ func (bbp *SomeMaps) MarshalBebopTo(buf []byte) int { iohelp.WriteGUIDBytes(buf[at:], k1) at += 16 (v1).MarshalBebopTo(buf[at:]) - tmp3624 := (v1); at += tmp3624.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -273,7 +275,8 @@ func (bbp *SomeMaps) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3719 := (((((bbp.M3)[i1])[k2])[i3])[k4]); at += tmp3719.Size() + tmp := (((((bbp.M3)[i1])[k2])[i3])[k4]) + at += tmp.Size() } } } @@ -320,7 +323,8 @@ func (bbp *SomeMaps) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3806 := ((bbp.M5)[k1]); at += tmp3806.Size() + tmp := ((bbp.M5)[k1]) + at += tmp.Size() } return nil } @@ -371,7 +375,8 @@ func (bbp *SomeMaps) MustUnmarshalBebop(buf []byte) { k4 := iohelp.ReadBoolBytes(buf[at:]) at += 1 ((((bbp.M3)[i1])[k2])[i3])[k4] = MustMakeSFromBytes(buf[at:]) - tmp3861 := (((((bbp.M3)[i1])[k2])[i3])[k4]); at += tmp3861.Size() + tmp := (((((bbp.M3)[i1])[k2])[i3])[k4]) + at += tmp.Size() } } } @@ -400,7 +405,8 @@ func (bbp *SomeMaps) MustUnmarshalBebop(buf []byte) { k1 := iohelp.ReadGUIDBytes(buf[at:]) at += 16 (bbp.M5)[k1] = MustMakeMFromBytes(buf[at:]) - tmp4145 := ((bbp.M5)[k1]); at += tmp4145.Size() + tmp := ((bbp.M5)[k1]) + at += tmp.Size() } } @@ -553,7 +559,8 @@ func (bbp *SomeMaps) Size() int { bodyLen += 4 for _, v4 := range elem { bodyLen += 1 - tmp4580 := (v4); bodyLen += tmp4580.Size() + tmp := (v4) + bodyLen += tmp.Size() } } } @@ -570,7 +577,8 @@ func (bbp *SomeMaps) Size() int { bodyLen += 4 for _, v1 := range bbp.M5 { bodyLen += 16 - tmp4646 := (v1); bodyLen += tmp4646.Size() + tmp := (v1) + bodyLen += tmp.Size() } return bodyLen } @@ -581,7 +589,7 @@ func (bbp *SomeMaps) MarshalBebop() []byte { return buf } -func MakeSomeMaps(r iohelp.ErrorReader) (SomeMaps, error) { +func MakeSomeMaps(r *iohelp.ErrorReader) (SomeMaps, error) { v := SomeMaps{} err := v.DecodeBebop(r) return v, err @@ -703,7 +711,7 @@ func (bbp *M) DecodeBebop(ior io.Reader) (err error) { bbp.B = new(float64) *bbp.B = iohelp.ReadFloat64(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -728,7 +736,7 @@ func (bbp *M) MarshalBebop() []byte { return buf } -func MakeM(r iohelp.ErrorReader) (M, error) { +func MakeM(r *iohelp.ErrorReader) (M, error) { v := M{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/message_1.go b/testdata/generated-always-pointers/message_1.go index 9e17531..c7a8254 100644 --- a/testdata/generated-always-pointers/message_1.go +++ b/testdata/generated-always-pointers/message_1.go @@ -139,7 +139,7 @@ func (bbp *ExampleMessage) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(int32) *bbp.Z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -168,7 +168,7 @@ func (bbp *ExampleMessage) MarshalBebop() []byte { return buf } -func MakeExampleMessage(r iohelp.ErrorReader) (ExampleMessage, error) { +func MakeExampleMessage(r *iohelp.ErrorReader) (ExampleMessage, error) { v := ExampleMessage{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/message_map.go b/testdata/generated-always-pointers/message_map.go index c08c663..06ba06e 100644 --- a/testdata/generated-always-pointers/message_map.go +++ b/testdata/generated-always-pointers/message_map.go @@ -119,7 +119,7 @@ func (bbp *ReadOnlyMap) DecodeBebop(ior io.Reader) (err error) { (*bbp.Vals)[k3] = iohelp.ReadUint8(r) } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -144,7 +144,7 @@ func (bbp *ReadOnlyMap) MarshalBebop() []byte { return buf } -func MakeReadOnlyMap(r iohelp.ErrorReader) (ReadOnlyMap, error) { +func MakeReadOnlyMap(r *iohelp.ErrorReader) (ReadOnlyMap, error) { v := ReadOnlyMap{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/msgpack_comparison.go b/testdata/generated-always-pointers/msgpack_comparison.go index e3cb9ea..1f7af47 100644 --- a/testdata/generated-always-pointers/msgpack_comparison.go +++ b/testdata/generated-always-pointers/msgpack_comparison.go @@ -404,7 +404,7 @@ func (bbp *MsgpackComparison) MarshalBebop() []byte { return buf } -func MakeMsgpackComparison(r iohelp.ErrorReader) (MsgpackComparison, error) { +func MakeMsgpackComparison(r *iohelp.ErrorReader) (MsgpackComparison, error) { v := MsgpackComparison{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/request.go b/testdata/generated-always-pointers/request.go index 69b6230..6a1d5dc 100644 --- a/testdata/generated-always-pointers/request.go +++ b/testdata/generated-always-pointers/request.go @@ -94,7 +94,7 @@ func (bbp *Furniture) MarshalBebop() []byte { return buf } -func MakeFurniture(r iohelp.ErrorReader) (Furniture, error) { +func MakeFurniture(r *iohelp.ErrorReader) (Furniture, error) { v := Furniture{} err := v.DecodeBebop(r) return v, err @@ -150,7 +150,8 @@ func (bbp *RequestResponse) MarshalBebopTo(buf []byte) int { at += 4 for _, v1 := range bbp.availableFurniture { (v1).MarshalBebopTo(buf[at:]) - tmp3307 := (v1); at += tmp3307.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -167,7 +168,8 @@ func (bbp *RequestResponse) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3326 := ((bbp.availableFurniture)[i1]); at += tmp3326.Size() + tmp := ((bbp.availableFurniture)[i1]) + at += tmp.Size() } return nil } @@ -178,7 +180,8 @@ func (bbp *RequestResponse) MustUnmarshalBebop(buf []byte) { at += 4 for i1 := range bbp.availableFurniture { (bbp.availableFurniture)[i1] = MustMakeFurnitureFromBytes(buf[at:]) - tmp3333 := ((bbp.availableFurniture)[i1]); at += tmp3333.Size() + tmp := ((bbp.availableFurniture)[i1]) + at += tmp.Size() } } @@ -210,7 +213,8 @@ func (bbp *RequestResponse) Size() int { bodyLen := 0 bodyLen += 4 for _, elem := range bbp.availableFurniture { - tmp3348 := (elem); bodyLen += tmp3348.Size() + tmp := (elem) + bodyLen += tmp.Size() } return bodyLen } @@ -221,7 +225,7 @@ func (bbp *RequestResponse) MarshalBebop() []byte { return buf } -func MakeRequestResponse(r iohelp.ErrorReader) (RequestResponse, error) { +func MakeRequestResponse(r *iohelp.ErrorReader) (RequestResponse, error) { v := RequestResponse{} err := v.DecodeBebop(r) return v, err @@ -345,7 +349,7 @@ func (bbp *RequestCatalog) DecodeBebop(ior io.Reader) (err error) { bbp.SecretTunnel = new(string) *bbp.SecretTunnel = iohelp.ReadString(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -366,7 +370,7 @@ func (bbp *RequestCatalog) MarshalBebop() []byte { return buf } -func MakeRequestCatalog(r iohelp.ErrorReader) (RequestCatalog, error) { +func MakeRequestCatalog(r *iohelp.ErrorReader) (RequestCatalog, error) { v := RequestCatalog{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/server.go b/testdata/generated-always-pointers/server.go index 49846f6..387c5bf 100644 --- a/testdata/generated-always-pointers/server.go +++ b/testdata/generated-always-pointers/server.go @@ -63,7 +63,7 @@ func (bbp *Print) MarshalBebop() []byte { return buf } -func MakePrint(r iohelp.ErrorReader) (Print, error) { +func MakePrint(r *iohelp.ErrorReader) (Print, error) { v := Print{} err := v.DecodeBebop(r) return v, err @@ -147,7 +147,7 @@ func (bbp *Add) MarshalBebop() []byte { return buf } -func MakeAdd(r iohelp.ErrorReader) (Add, error) { +func MakeAdd(r *iohelp.ErrorReader) (Add, error) { v := Add{} err := v.DecodeBebop(r) return v, err @@ -218,7 +218,7 @@ func (bbp *AddResponse) MarshalBebop() []byte { return buf } -func MakeAddResponse(r iohelp.ErrorReader) (AddResponse, error) { +func MakeAddResponse(r *iohelp.ErrorReader) (AddResponse, error) { v := AddResponse{} err := v.DecodeBebop(r) return v, err @@ -252,7 +252,8 @@ func (bbp *PrintRequest) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Print).MarshalBebopTo(buf[at:]) - tmp3135 := (*bbp.Print); at += tmp3135.Size() + tmp := (*bbp.Print) + at += tmp.Size() } return at } @@ -270,7 +271,8 @@ func (bbp *PrintRequest) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3143 := ((*bbp.Print)); at += tmp3143.Size() + tmp := ((*bbp.Print)) + at += tmp.Size() default: return nil } @@ -287,7 +289,8 @@ func (bbp *PrintRequest) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Print = new(Print) (*bbp.Print) = MustMakePrintFromBytes(buf[at:]) - tmp3149 := ((*bbp.Print)); at += tmp3149.Size() + tmp := ((*bbp.Print)) + at += tmp.Size() default: return } @@ -321,7 +324,7 @@ func (bbp *PrintRequest) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -331,7 +334,8 @@ func (bbp *PrintRequest) Size() int { bodyLen := 5 if bbp.Print != nil { bodyLen += 1 - tmp3162 := (*bbp.Print); bodyLen += tmp3162.Size() + tmp := (*bbp.Print) + bodyLen += tmp.Size() } return bodyLen } @@ -342,7 +346,7 @@ func (bbp *PrintRequest) MarshalBebop() []byte { return buf } -func MakePrintRequest(r iohelp.ErrorReader) (PrintRequest, error) { +func MakePrintRequest(r *iohelp.ErrorReader) (PrintRequest, error) { v := PrintRequest{} err := v.DecodeBebop(r) return v, err @@ -376,7 +380,8 @@ func (bbp *AddRequest) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Add).MarshalBebopTo(buf[at:]) - tmp3186 := (*bbp.Add); at += tmp3186.Size() + tmp := (*bbp.Add) + at += tmp.Size() } return at } @@ -394,7 +399,8 @@ func (bbp *AddRequest) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3200 := ((*bbp.Add)); at += tmp3200.Size() + tmp := ((*bbp.Add)) + at += tmp.Size() default: return nil } @@ -411,7 +417,8 @@ func (bbp *AddRequest) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Add = new(Add) (*bbp.Add) = MustMakeAddFromBytes(buf[at:]) - tmp3205 := ((*bbp.Add)); at += tmp3205.Size() + tmp := ((*bbp.Add)) + at += tmp.Size() default: return } @@ -445,7 +452,7 @@ func (bbp *AddRequest) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -455,7 +462,8 @@ func (bbp *AddRequest) Size() int { bodyLen := 5 if bbp.Add != nil { bodyLen += 1 - tmp3235 := (*bbp.Add); bodyLen += tmp3235.Size() + tmp := (*bbp.Add) + bodyLen += tmp.Size() } return bodyLen } @@ -466,7 +474,7 @@ func (bbp *AddRequest) MarshalBebop() []byte { return buf } -func MakeAddRequest(r iohelp.ErrorReader) (AddRequest, error) { +func MakeAddRequest(r *iohelp.ErrorReader) (AddRequest, error) { v := AddRequest{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/tags.go b/testdata/generated-always-pointers/tags.go index 26e9944..60cf7cd 100644 --- a/testdata/generated-always-pointers/tags.go +++ b/testdata/generated-always-pointers/tags.go @@ -63,7 +63,7 @@ func (bbp *TaggedStruct) MarshalBebop() []byte { return buf } -func MakeTaggedStruct(r iohelp.ErrorReader) (TaggedStruct, error) { +func MakeTaggedStruct(r *iohelp.ErrorReader) (TaggedStruct, error) { v := TaggedStruct{} err := v.DecodeBebop(r) return v, err @@ -158,7 +158,7 @@ func (bbp *TaggedMessage) DecodeBebop(ior io.Reader) (err error) { bbp.Bar = new(uint8) *bbp.Bar = iohelp.ReadUint8(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -179,7 +179,7 @@ func (bbp *TaggedMessage) MarshalBebop() []byte { return buf } -func MakeTaggedMessage(r iohelp.ErrorReader) (TaggedMessage, error) { +func MakeTaggedMessage(r *iohelp.ErrorReader) (TaggedMessage, error) { v := TaggedMessage{} err := v.DecodeBebop(r) return v, err @@ -250,7 +250,7 @@ func (bbp *TaggedSubStruct) MarshalBebop() []byte { return buf } -func MakeTaggedSubStruct(r iohelp.ErrorReader) (TaggedSubStruct, error) { +func MakeTaggedSubStruct(r *iohelp.ErrorReader) (TaggedSubStruct, error) { v := TaggedSubStruct{} err := v.DecodeBebop(r) return v, err @@ -282,7 +282,8 @@ func (bbp *TaggedUnion) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.TaggedSubStruct).MarshalBebopTo(buf[at:]) - tmp3004 := (*bbp.TaggedSubStruct); at += tmp3004.Size() + tmp := (*bbp.TaggedSubStruct) + at += tmp.Size() return at } return at @@ -304,7 +305,8 @@ func (bbp *TaggedUnion) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3018 := ((*bbp.TaggedSubStruct)); at += tmp3018.Size() + tmp := ((*bbp.TaggedSubStruct)) + at += tmp.Size() return nil default: return nil @@ -322,7 +324,8 @@ func (bbp *TaggedUnion) MustUnmarshalBebop(buf []byte) { at += 1 bbp.TaggedSubStruct = new(TaggedSubStruct) (*bbp.TaggedSubStruct) = MustMakeTaggedSubStructFromBytes(buf[at:]) - tmp3074 := ((*bbp.TaggedSubStruct)); at += tmp3074.Size() + tmp := ((*bbp.TaggedSubStruct)) + at += tmp.Size() return default: return @@ -356,10 +359,10 @@ func (bbp *TaggedUnion) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -369,7 +372,8 @@ func (bbp *TaggedUnion) Size() int { bodyLen := 4 if bbp.TaggedSubStruct != nil { bodyLen += 1 - tmp3104 := (*bbp.TaggedSubStruct); bodyLen += tmp3104.Size() + tmp := (*bbp.TaggedSubStruct) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -381,7 +385,7 @@ func (bbp *TaggedUnion) MarshalBebop() []byte { return buf } -func MakeTaggedUnion(r iohelp.ErrorReader) (TaggedUnion, error) { +func MakeTaggedUnion(r *iohelp.ErrorReader) (TaggedUnion, error) { v := TaggedUnion{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/typed_enums.go b/testdata/generated-always-pointers/typed_enums.go index 0ac3adb..e410712 100644 --- a/testdata/generated-always-pointers/typed_enums.go +++ b/testdata/generated-always-pointers/typed_enums.go @@ -174,7 +174,7 @@ func (bbp *UsesAllEnums) MarshalBebop() []byte { return buf } -func MakeUsesAllEnums(r iohelp.ErrorReader) (UsesAllEnums, error) { +func MakeUsesAllEnums(r *iohelp.ErrorReader) (UsesAllEnums, error) { v := UsesAllEnums{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/union.go b/testdata/generated-always-pointers/union.go index 0eab551..2c35909 100644 --- a/testdata/generated-always-pointers/union.go +++ b/testdata/generated-always-pointers/union.go @@ -85,7 +85,7 @@ func (bbp *A) DecodeBebop(ior io.Reader) (err error) { bbp.B = new(uint32) *bbp.B = iohelp.ReadUint32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -106,7 +106,7 @@ func (bbp *A) MarshalBebop() []byte { return buf } -func MakeA(r iohelp.ErrorReader) (A, error) { +func MakeA(r *iohelp.ErrorReader) (A, error) { v := A{} err := v.DecodeBebop(r) return v, err @@ -180,7 +180,7 @@ func (bbp *B) MarshalBebop() []byte { return buf } -func MakeB(r iohelp.ErrorReader) (B, error) { +func MakeB(r *iohelp.ErrorReader) (B, error) { v := B{} err := v.DecodeBebop(r) return v, err @@ -230,7 +230,7 @@ func (bbp *C) MarshalBebop() []byte { return []byte{} } -func MakeC(r iohelp.ErrorReader) (C, error) { +func MakeC(r *iohelp.ErrorReader) (C, error) { return C{}, nil } @@ -263,21 +263,24 @@ func (bbp *U) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.A).MarshalBebopTo(buf[at:]) - tmp3285 := (*bbp.A); at += tmp3285.Size() + tmp := (*bbp.A) + at += tmp.Size() return at } if bbp.B != nil { buf[at] = 2 at++ (*bbp.B).MarshalBebopTo(buf[at:]) - tmp3296 := (*bbp.B); at += tmp3296.Size() + tmp := (*bbp.B) + at += tmp.Size() return at } if bbp.C != nil { buf[at] = 3 at++ (*bbp.C).MarshalBebopTo(buf[at:]) - tmp3314 := (*bbp.C); at += tmp3314.Size() + tmp := (*bbp.C) + at += tmp.Size() return at } return at @@ -299,7 +302,8 @@ func (bbp *U) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3330 := ((*bbp.A)); at += tmp3330.Size() + tmp := ((*bbp.A)) + at += tmp.Size() return nil case 2: at += 1 @@ -308,7 +312,8 @@ func (bbp *U) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3335 := ((*bbp.B)); at += tmp3335.Size() + tmp := ((*bbp.B)) + at += tmp.Size() return nil case 3: at += 1 @@ -317,7 +322,8 @@ func (bbp *U) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3337 := ((*bbp.C)); at += tmp3337.Size() + tmp := ((*bbp.C)) + at += tmp.Size() return nil default: return nil @@ -335,19 +341,22 @@ func (bbp *U) MustUnmarshalBebop(buf []byte) { at += 1 bbp.A = new(A) (*bbp.A) = MustMakeAFromBytes(buf[at:]) - tmp3360 := ((*bbp.A)); at += tmp3360.Size() + tmp := ((*bbp.A)) + at += tmp.Size() return case 2: at += 1 bbp.B = new(B) (*bbp.B) = MustMakeBFromBytes(buf[at:]) - tmp3366 := ((*bbp.B)); at += tmp3366.Size() + tmp := ((*bbp.B)) + at += tmp.Size() return case 3: at += 1 bbp.C = new(C) (*bbp.C) = MustMakeCFromBytes(buf[at:]) - tmp3373 := ((*bbp.C)); at += tmp3373.Size() + tmp := ((*bbp.C)) + at += tmp.Size() return default: return @@ -397,7 +406,7 @@ func (bbp *U) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.B = new(B) @@ -405,7 +414,7 @@ func (bbp *U) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 3: bbp.C = new(C) @@ -413,10 +422,10 @@ func (bbp *U) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -426,17 +435,20 @@ func (bbp *U) Size() int { bodyLen := 4 if bbp.A != nil { bodyLen += 1 - tmp3477 := (*bbp.A); bodyLen += tmp3477.Size() + tmp := (*bbp.A) + bodyLen += tmp.Size() return bodyLen } if bbp.B != nil { bodyLen += 1 - tmp3487 := (*bbp.B); bodyLen += tmp3487.Size() + tmp := (*bbp.B) + bodyLen += tmp.Size() return bodyLen } if bbp.C != nil { bodyLen += 1 - tmp3501 := (*bbp.C); bodyLen += tmp3501.Size() + tmp := (*bbp.C) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -448,7 +460,7 @@ func (bbp *U) MarshalBebop() []byte { return buf } -func MakeU(r iohelp.ErrorReader) (U, error) { +func MakeU(r *iohelp.ErrorReader) (U, error) { v := U{} err := v.DecodeBebop(r) return v, err @@ -478,7 +490,8 @@ func (bbp *Cons) MarshalBebopTo(buf []byte) int { iohelp.WriteUint32Bytes(buf[at:], bbp.Head) at += 4 (bbp.Tail).MarshalBebopTo(buf[at:]) - tmp3573 := (bbp.Tail); at += tmp3573.Size() + tmp := (bbp.Tail) + at += tmp.Size() return at } @@ -493,7 +506,8 @@ func (bbp *Cons) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3602 := (bbp.Tail); at += tmp3602.Size() + tmp := (bbp.Tail) + at += tmp.Size() return nil } @@ -502,7 +516,8 @@ func (bbp *Cons) MustUnmarshalBebop(buf []byte) { bbp.Head = iohelp.ReadUint32Bytes(buf[at:]) at += 4 bbp.Tail = MustMakeListFromBytes(buf[at:]) - tmp3617 := (bbp.Tail); at += tmp3617.Size() + tmp := (bbp.Tail) + at += tmp.Size() } func (bbp *Cons) EncodeBebop(iow io.Writer) (err error) { @@ -528,7 +543,8 @@ func (bbp *Cons) DecodeBebop(ior io.Reader) (err error) { func (bbp *Cons) Size() int { bodyLen := 0 bodyLen += 4 - tmp3635 := (bbp.Tail); bodyLen += tmp3635.Size() + tmp := (bbp.Tail) + bodyLen += tmp.Size() return bodyLen } @@ -538,7 +554,7 @@ func (bbp *Cons) MarshalBebop() []byte { return buf } -func MakeCons(r iohelp.ErrorReader) (Cons, error) { +func MakeCons(r *iohelp.ErrorReader) (Cons, error) { v := Cons{} err := v.DecodeBebop(r) return v, err @@ -589,7 +605,7 @@ func (bbp *Null) MarshalBebop() []byte { return []byte{} } -func MakeNull(r iohelp.ErrorReader) (Null, error) { +func MakeNull(r *iohelp.ErrorReader) (Null, error) { return Null{}, nil } @@ -616,14 +632,16 @@ func (bbp *List) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Cons).MarshalBebopTo(buf[at:]) - tmp3779 := (*bbp.Cons); at += tmp3779.Size() + tmp := (*bbp.Cons) + at += tmp.Size() return at } if bbp.Null != nil { buf[at] = 2 at++ (*bbp.Null).MarshalBebopTo(buf[at:]) - tmp3793 := (*bbp.Null); at += tmp3793.Size() + tmp := (*bbp.Null) + at += tmp.Size() return at } return at @@ -645,7 +663,8 @@ func (bbp *List) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3815 := ((*bbp.Cons)); at += tmp3815.Size() + tmp := ((*bbp.Cons)) + at += tmp.Size() return nil case 2: at += 1 @@ -654,7 +673,8 @@ func (bbp *List) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3834 := ((*bbp.Null)); at += tmp3834.Size() + tmp := ((*bbp.Null)) + at += tmp.Size() return nil default: return nil @@ -672,13 +692,15 @@ func (bbp *List) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Cons = new(Cons) (*bbp.Cons) = MustMakeConsFromBytes(buf[at:]) - tmp3856 := ((*bbp.Cons)); at += tmp3856.Size() + tmp := ((*bbp.Cons)) + at += tmp.Size() return case 2: at += 1 bbp.Null = new(Null) (*bbp.Null) = MustMakeNullFromBytes(buf[at:]) - tmp3863 := ((*bbp.Null)); at += tmp3863.Size() + tmp := ((*bbp.Null)) + at += tmp.Size() return default: return @@ -720,7 +742,7 @@ func (bbp *List) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.Null = new(Null) @@ -728,10 +750,10 @@ func (bbp *List) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -741,12 +763,14 @@ func (bbp *List) Size() int { bodyLen := 4 if bbp.Cons != nil { bodyLen += 1 - tmp3908 := (*bbp.Cons); bodyLen += tmp3908.Size() + tmp := (*bbp.Cons) + bodyLen += tmp.Size() return bodyLen } if bbp.Null != nil { bodyLen += 1 - tmp3916 := (*bbp.Null); bodyLen += tmp3916.Size() + tmp := (*bbp.Null) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -758,7 +782,7 @@ func (bbp *List) MarshalBebop() []byte { return buf } -func MakeList(r iohelp.ErrorReader) (List, error) { +func MakeList(r *iohelp.ErrorReader) (List, error) { v := List{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-always-pointers/union_field.go b/testdata/generated-always-pointers/union_field.go index a9e0c4b..aa0cf64 100644 --- a/testdata/generated-always-pointers/union_field.go +++ b/testdata/generated-always-pointers/union_field.go @@ -22,7 +22,8 @@ func (bbp *WithUnionField) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Test).MarshalBebopTo(buf[at:]) - tmp3118 := (*bbp.Test); at += tmp3118.Size() + tmp := (*bbp.Test) + at += tmp.Size() } return at } @@ -40,7 +41,8 @@ func (bbp *WithUnionField) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3120 := ((*bbp.Test)); at += tmp3120.Size() + tmp := ((*bbp.Test)) + at += tmp.Size() default: return nil } @@ -57,7 +59,8 @@ func (bbp *WithUnionField) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Test = new(List2) (*bbp.Test) = MustMakeList2FromBytes(buf[at:]) - tmp3121 := ((*bbp.Test)); at += tmp3121.Size() + tmp := ((*bbp.Test)) + at += tmp.Size() default: return } @@ -91,7 +94,7 @@ func (bbp *WithUnionField) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -101,7 +104,8 @@ func (bbp *WithUnionField) Size() int { bodyLen := 5 if bbp.Test != nil { bodyLen += 1 - tmp3130 := (*bbp.Test); bodyLen += tmp3130.Size() + tmp := (*bbp.Test) + bodyLen += tmp.Size() } return bodyLen } @@ -112,7 +116,7 @@ func (bbp *WithUnionField) MarshalBebop() []byte { return buf } -func MakeWithUnionField(r iohelp.ErrorReader) (WithUnionField, error) { +func MakeWithUnionField(r *iohelp.ErrorReader) (WithUnionField, error) { v := WithUnionField{} err := v.DecodeBebop(r) return v, err @@ -190,7 +194,7 @@ func (bbp *Cons2) MarshalBebop() []byte { return buf } -func MakeCons2(r iohelp.ErrorReader) (Cons2, error) { +func MakeCons2(r *iohelp.ErrorReader) (Cons2, error) { v := Cons2{} err := v.DecodeBebop(r) return v, err @@ -241,7 +245,7 @@ func (bbp *Nil2) MarshalBebop() []byte { return []byte{} } -func MakeNil2(r iohelp.ErrorReader) (Nil2, error) { +func MakeNil2(r *iohelp.ErrorReader) (Nil2, error) { return Nil2{}, nil } @@ -268,14 +272,16 @@ func (bbp *List2) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Cons2).MarshalBebopTo(buf[at:]) - tmp3168 := (*bbp.Cons2); at += tmp3168.Size() + tmp := (*bbp.Cons2) + at += tmp.Size() return at } if bbp.Nil2 != nil { buf[at] = 2 at++ (*bbp.Nil2).MarshalBebopTo(buf[at:]) - tmp3174 := (*bbp.Nil2); at += tmp3174.Size() + tmp := (*bbp.Nil2) + at += tmp.Size() return at } return at @@ -297,7 +303,8 @@ func (bbp *List2) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3177 := ((*bbp.Cons2)); at += tmp3177.Size() + tmp := ((*bbp.Cons2)) + at += tmp.Size() return nil case 2: at += 1 @@ -306,7 +313,8 @@ func (bbp *List2) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp3180 := ((*bbp.Nil2)); at += tmp3180.Size() + tmp := ((*bbp.Nil2)) + at += tmp.Size() return nil default: return nil @@ -324,13 +332,15 @@ func (bbp *List2) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Cons2 = new(Cons2) (*bbp.Cons2) = MustMakeCons2FromBytes(buf[at:]) - tmp3188 := ((*bbp.Cons2)); at += tmp3188.Size() + tmp := ((*bbp.Cons2)) + at += tmp.Size() return case 2: at += 1 bbp.Nil2 = new(Nil2) (*bbp.Nil2) = MustMakeNil2FromBytes(buf[at:]) - tmp3189 := ((*bbp.Nil2)); at += tmp3189.Size() + tmp := ((*bbp.Nil2)) + at += tmp.Size() return default: return @@ -372,7 +382,7 @@ func (bbp *List2) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.Nil2 = new(Nil2) @@ -380,10 +390,10 @@ func (bbp *List2) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -393,12 +403,14 @@ func (bbp *List2) Size() int { bodyLen := 4 if bbp.Cons2 != nil { bodyLen += 1 - tmp3207 := (*bbp.Cons2); bodyLen += tmp3207.Size() + tmp := (*bbp.Cons2) + bodyLen += tmp.Size() return bodyLen } if bbp.Nil2 != nil { bodyLen += 1 - tmp3213 := (*bbp.Nil2); bodyLen += tmp3213.Size() + tmp := (*bbp.Nil2) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -410,7 +422,7 @@ func (bbp *List2) MarshalBebop() []byte { return buf } -func MakeList2(r iohelp.ErrorReader) (List2, error) { +func MakeList2(r *iohelp.ErrorReader) (List2, error) { v := List2{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/array_of_strings.go b/testdata/generated-private/array_of_strings.go index d52d154..62c4edf 100644 --- a/testdata/generated-private/array_of_strings.go +++ b/testdata/generated-private/array_of_strings.go @@ -87,7 +87,7 @@ func (bbp arrayOfStrings) MarshalBebop() []byte { return buf } -func makearrayOfStrings(r iohelp.ErrorReader) (arrayOfStrings, error) { +func makearrayOfStrings(r *iohelp.ErrorReader) (arrayOfStrings, error) { v := arrayOfStrings{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/arrays.go b/testdata/generated-private/arrays.go index a7cccf7..4cdbec4 100644 --- a/testdata/generated-private/arrays.go +++ b/testdata/generated-private/arrays.go @@ -194,7 +194,7 @@ func (bbp arraySamples) MarshalBebop() []byte { return buf } -func makearraySamples(r iohelp.ErrorReader) (arraySamples, error) { +func makearraySamples(r *iohelp.ErrorReader) (arraySamples, error) { v := arraySamples{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/basic_arrays.go b/testdata/generated-private/basic_arrays.go index 3950262..8d04789 100644 --- a/testdata/generated-private/basic_arrays.go +++ b/testdata/generated-private/basic_arrays.go @@ -462,7 +462,7 @@ func (bbp basicArrays) MarshalBebop() []byte { return buf } -func makebasicArrays(r iohelp.ErrorReader) (basicArrays, error) { +func makebasicArrays(r *iohelp.ErrorReader) (basicArrays, error) { v := basicArrays{} err := v.DecodeBebop(r) return v, err @@ -555,7 +555,7 @@ func (bbp testInt32Array) MarshalBebop() []byte { return buf } -func maketestInt32Array(r iohelp.ErrorReader) (testInt32Array, error) { +func maketestInt32Array(r *iohelp.ErrorReader) (testInt32Array, error) { v := testInt32Array{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/basic_types.go b/testdata/generated-private/basic_types.go index 7e42a3b..8d473bd 100644 --- a/testdata/generated-private/basic_types.go +++ b/testdata/generated-private/basic_types.go @@ -228,7 +228,7 @@ func (bbp basicTypes) MarshalBebop() []byte { return buf } -func makebasicTypes(r iohelp.ErrorReader) (basicTypes, error) { +func makebasicTypes(r *iohelp.ErrorReader) (basicTypes, error) { v := basicTypes{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/date.go b/testdata/generated-private/date.go index f71b9d0..4ff05b8 100644 --- a/testdata/generated-private/date.go +++ b/testdata/generated-private/date.go @@ -129,7 +129,7 @@ func (bbp *myObj) DecodeBebop(ior io.Reader) (err error) { bbp.end = new(time.Time) *bbp.end = iohelp.ReadDate(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -154,7 +154,7 @@ func (bbp myObj) MarshalBebop() []byte { return buf } -func makemyObj(r iohelp.ErrorReader) (myObj, error) { +func makemyObj(r *iohelp.ErrorReader) (myObj, error) { v := myObj{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/documentation.go b/testdata/generated-private/documentation.go index e4c2dd5..f54e3d5 100644 --- a/testdata/generated-private/documentation.go +++ b/testdata/generated-private/documentation.go @@ -83,7 +83,7 @@ func (bbp docS) MarshalBebop() []byte { return buf } -func makedocS(r iohelp.ErrorReader) (docS, error) { +func makedocS(r *iohelp.ErrorReader) (docS, error) { v := docS{} err := v.DecodeBebop(r) return v, err @@ -169,7 +169,7 @@ func (bbp *depM) DecodeBebop(ior io.Reader) (err error) { bbp.x = new(int32) *bbp.x = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -186,7 +186,7 @@ func (bbp depM) MarshalBebop() []byte { return buf } -func makedepM(r iohelp.ErrorReader) (depM, error) { +func makedepM(r *iohelp.ErrorReader) (depM, error) { v := depM{} err := v.DecodeBebop(r) return v, err @@ -320,7 +320,7 @@ func (bbp *docM) DecodeBebop(ior io.Reader) (err error) { bbp.z = new(int32) *bbp.z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -341,7 +341,7 @@ func (bbp docM) MarshalBebop() []byte { return buf } -func makedocM(r iohelp.ErrorReader) (docM, error) { +func makedocM(r *iohelp.ErrorReader) (docM, error) { v := docM{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/foo.go b/testdata/generated-private/foo.go index c5cbb60..2f3cff7 100644 --- a/testdata/generated-private/foo.go +++ b/testdata/generated-private/foo.go @@ -17,7 +17,8 @@ type foo struct { func (bbp foo) MarshalBebopTo(buf []byte) int { at := 0 (bbp.bar).MarshalBebopTo(buf[at:]) - tmp7570 := (bbp.bar); at += tmp7570.Size() + tmp := (bbp.bar) + at += tmp.Size() return at } @@ -27,14 +28,16 @@ func (bbp *foo) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7574 := (bbp.bar); at += tmp7574.Size() + tmp := (bbp.bar) + at += tmp.Size() return nil } func (bbp *foo) MustUnmarshalBebop(buf []byte) { at := 0 bbp.bar = mustMakebarFromBytes(buf[at:]) - tmp7581 := (bbp.bar); at += tmp7581.Size() + tmp := (bbp.bar) + at += tmp.Size() } func (bbp foo) EncodeBebop(iow io.Writer) (err error) { @@ -57,7 +60,8 @@ func (bbp *foo) DecodeBebop(ior io.Reader) (err error) { func (bbp foo) Size() int { bodyLen := 0 - tmp7596 := (bbp.bar); bodyLen += tmp7596.Size() + tmp := (bbp.bar) + bodyLen += tmp.Size() return bodyLen } @@ -67,7 +71,7 @@ func (bbp foo) MarshalBebop() []byte { return buf } -func makefoo(r iohelp.ErrorReader) (foo, error) { +func makefoo(r *iohelp.ErrorReader) (foo, error) { v := foo{} err := v.DecodeBebop(r) return v, err @@ -216,7 +220,7 @@ func (bbp *bar) DecodeBebop(ior io.Reader) (err error) { bbp.z = new(float64) *bbp.z = iohelp.ReadFloat64(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -245,7 +249,7 @@ func (bbp bar) MarshalBebop() []byte { return buf } -func makebar(r iohelp.ErrorReader) (bar, error) { +func makebar(r *iohelp.ErrorReader) (bar, error) { v := bar{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/jazz.go b/testdata/generated-private/jazz.go index faca299..ada75db 100644 --- a/testdata/generated-private/jazz.go +++ b/testdata/generated-private/jazz.go @@ -81,7 +81,7 @@ func (bbp musician) MarshalBebop() []byte { return buf } -func makemusician(r iohelp.ErrorReader) (musician, error) { +func makemusician(r *iohelp.ErrorReader) (musician, error) { v := musician{} err := v.DecodeBebop(r) return v, err @@ -131,7 +131,8 @@ func (bbp library) MarshalBebopTo(buf []byte) int { iohelp.WriteGUIDBytes(buf[at:], k1) at += 16 (v1).MarshalBebopTo(buf[at:]) - tmp7050 := (v1); at += tmp7050.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -151,7 +152,8 @@ func (bbp *library) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7078 := ((bbp.songs)[k1]); at += tmp7078.Size() + tmp := ((bbp.songs)[k1]) + at += tmp.Size() } return nil } @@ -165,7 +167,8 @@ func (bbp *library) MustUnmarshalBebop(buf []byte) { k1 := iohelp.ReadGUIDBytes(buf[at:]) at += 16 (bbp.songs)[k1] = mustMakesongFromBytes(buf[at:]) - tmp7105 := ((bbp.songs)[k1]); at += tmp7105.Size() + tmp := ((bbp.songs)[k1]) + at += tmp.Size() } } @@ -201,7 +204,8 @@ func (bbp library) Size() int { bodyLen += 4 for _, v1 := range bbp.songs { bodyLen += 16 - tmp8261 := (v1); bodyLen += tmp8261.Size() + tmp := (v1) + bodyLen += tmp.Size() } return bodyLen } @@ -212,7 +216,7 @@ func (bbp library) MarshalBebop() []byte { return buf } -func makelibrary(r iohelp.ErrorReader) (library, error) { +func makelibrary(r *iohelp.ErrorReader) (library, error) { v := library{} err := v.DecodeBebop(r) return v, err @@ -262,7 +266,8 @@ func (bbp song) MarshalBebopTo(buf []byte) int { at += 4 for _, v2 := range *bbp.performers { (v2).MarshalBebopTo(buf[at:]) - tmp8333 := (v2); at += tmp8333.Size() + tmp := (v2) + at += tmp.Size() } } return at @@ -303,7 +308,8 @@ func (bbp *song) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp8383 := (((*bbp.performers))[i3]); at += tmp8383.Size() + tmp := (((*bbp.performers))[i3]) + at += tmp.Size() } default: return nil @@ -334,7 +340,8 @@ func (bbp *song) MustUnmarshalBebop(buf []byte) { at += 4 for i3 := range (*bbp.performers) { ((*bbp.performers))[i3] = mustMakemusicianFromBytes(buf[at:]) - tmp8442 := (((*bbp.performers))[i3]); at += tmp8442.Size() + tmp := (((*bbp.performers))[i3]) + at += tmp.Size() } default: return @@ -390,7 +397,7 @@ func (bbp *song) DecodeBebop(ior io.Reader) (err error) { } } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -410,7 +417,8 @@ func (bbp song) Size() int { bodyLen += 1 bodyLen += 4 for _, elem := range *bbp.performers { - tmp8591 := (elem); bodyLen += tmp8591.Size() + tmp := (elem) + bodyLen += tmp.Size() } } return bodyLen @@ -422,7 +430,7 @@ func (bbp song) MarshalBebop() []byte { return buf } -func makesong(r iohelp.ErrorReader) (song, error) { +func makesong(r *iohelp.ErrorReader) (song, error) { v := song{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/lab.go b/testdata/generated-private/lab.go index d523791..ae9a13d 100644 --- a/testdata/generated-private/lab.go +++ b/testdata/generated-private/lab.go @@ -90,7 +90,7 @@ func (bbp int32s) MarshalBebop() []byte { return buf } -func makeint32s(r iohelp.ErrorReader) (int32s, error) { +func makeint32s(r *iohelp.ErrorReader) (int32s, error) { v := int32s{} err := v.DecodeBebop(r) return v, err @@ -183,7 +183,7 @@ func (bbp uint32s) MarshalBebop() []byte { return buf } -func makeuint32s(r iohelp.ErrorReader) (uint32s, error) { +func makeuint32s(r *iohelp.ErrorReader) (uint32s, error) { v := uint32s{} err := v.DecodeBebop(r) return v, err @@ -276,7 +276,7 @@ func (bbp float32s) MarshalBebop() []byte { return buf } -func makefloat32s(r iohelp.ErrorReader) (float32s, error) { +func makefloat32s(r *iohelp.ErrorReader) (float32s, error) { v := float32s{} err := v.DecodeBebop(r) return v, err @@ -369,7 +369,7 @@ func (bbp int64s) MarshalBebop() []byte { return buf } -func makeint64s(r iohelp.ErrorReader) (int64s, error) { +func makeint64s(r *iohelp.ErrorReader) (int64s, error) { v := int64s{} err := v.DecodeBebop(r) return v, err @@ -462,7 +462,7 @@ func (bbp uint64s) MarshalBebop() []byte { return buf } -func makeuint64s(r iohelp.ErrorReader) (uint64s, error) { +func makeuint64s(r *iohelp.ErrorReader) (uint64s, error) { v := uint64s{} err := v.DecodeBebop(r) return v, err @@ -555,7 +555,7 @@ func (bbp float64s) MarshalBebop() []byte { return buf } -func makefloat64s(r iohelp.ErrorReader) (float64s, error) { +func makefloat64s(r *iohelp.ErrorReader) (float64s, error) { v := float64s{} err := v.DecodeBebop(r) return v, err @@ -677,7 +677,7 @@ func (bbp videoData) MarshalBebop() []byte { return buf } -func makevideoData(r iohelp.ErrorReader) (videoData, error) { +func makevideoData(r *iohelp.ErrorReader) (videoData, error) { v := videoData{} err := v.DecodeBebop(r) return v, err @@ -716,7 +716,8 @@ func (bbp mediaMessage) MarshalBebopTo(buf []byte) int { buf[at] = 2 at++ (*bbp.data).MarshalBebopTo(buf[at:]) - tmp8193 := (*bbp.data); at += tmp8193.Size() + tmp := (*bbp.data) + at += tmp.Size() } return at } @@ -739,7 +740,8 @@ func (bbp *mediaMessage) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp8204 := ((*bbp.data)); at += tmp8204.Size() + tmp := ((*bbp.data)) + at += tmp.Size() default: return nil } @@ -761,7 +763,8 @@ func (bbp *mediaMessage) MustUnmarshalBebop(buf []byte) { at += 1 bbp.data = new(videoData) (*bbp.data) = mustMakevideoDataFromBytes(buf[at:]) - tmp8706 := ((*bbp.data)); at += tmp8706.Size() + tmp := ((*bbp.data)) + at += tmp.Size() default: return } @@ -802,7 +805,7 @@ func (bbp *mediaMessage) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -816,7 +819,8 @@ func (bbp mediaMessage) Size() int { } if bbp.data != nil { bodyLen += 1 - tmp8723 := (*bbp.data); bodyLen += tmp8723.Size() + tmp := (*bbp.data) + bodyLen += tmp.Size() } return bodyLen } @@ -827,7 +831,7 @@ func (bbp mediaMessage) MarshalBebop() []byte { return buf } -func makemediaMessage(r iohelp.ErrorReader) (mediaMessage, error) { +func makemediaMessage(r *iohelp.ErrorReader) (mediaMessage, error) { v := mediaMessage{} err := v.DecodeBebop(r) return v, err @@ -950,7 +954,7 @@ func (bbp *skipTestOld) DecodeBebop(ior io.Reader) (err error) { bbp.y = new(int32) *bbp.y = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -975,7 +979,7 @@ func (bbp skipTestOld) MarshalBebop() []byte { return buf } -func makeskipTestOld(r iohelp.ErrorReader) (skipTestOld, error) { +func makeskipTestOld(r *iohelp.ErrorReader) (skipTestOld, error) { v := skipTestOld{} err := v.DecodeBebop(r) return v, err @@ -1124,7 +1128,7 @@ func (bbp *skipTestNew) DecodeBebop(ior io.Reader) (err error) { bbp.z = new(int32) *bbp.z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1153,7 +1157,7 @@ func (bbp skipTestNew) MarshalBebop() []byte { return buf } -func makeskipTestNew(r iohelp.ErrorReader) (skipTestNew, error) { +func makeskipTestNew(r *iohelp.ErrorReader) (skipTestNew, error) { v := skipTestNew{} err := v.DecodeBebop(r) return v, err @@ -1186,7 +1190,8 @@ func (bbp skipTestOldContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.s).MarshalBebopTo(buf[at:]) - tmp8823 := (*bbp.s); at += tmp8823.Size() + tmp := (*bbp.s) + at += tmp.Size() } if bbp.after != nil { buf[at] = 2 @@ -1210,7 +1215,8 @@ func (bbp *skipTestOldContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp8830 := ((*bbp.s)); at += tmp8830.Size() + tmp := ((*bbp.s)) + at += tmp.Size() case 2: at += 1 bbp.after = new(int32) @@ -1235,7 +1241,8 @@ func (bbp *skipTestOldContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.s = new(skipTestOld) (*bbp.s) = mustMakeskipTestOldFromBytes(buf[at:]) - tmp8835 := ((*bbp.s)); at += tmp8835.Size() + tmp := ((*bbp.s)) + at += tmp.Size() case 2: at += 1 bbp.after = new(int32) @@ -1281,7 +1288,7 @@ func (bbp *skipTestOldContainer) DecodeBebop(ior io.Reader) (err error) { bbp.after = new(int32) *bbp.after = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1291,7 +1298,8 @@ func (bbp skipTestOldContainer) Size() int { bodyLen := 5 if bbp.s != nil { bodyLen += 1 - tmp8849 := (*bbp.s); bodyLen += tmp8849.Size() + tmp := (*bbp.s) + bodyLen += tmp.Size() } if bbp.after != nil { bodyLen += 1 @@ -1306,7 +1314,7 @@ func (bbp skipTestOldContainer) MarshalBebop() []byte { return buf } -func makeskipTestOldContainer(r iohelp.ErrorReader) (skipTestOldContainer, error) { +func makeskipTestOldContainer(r *iohelp.ErrorReader) (skipTestOldContainer, error) { v := skipTestOldContainer{} err := v.DecodeBebop(r) return v, err @@ -1339,7 +1347,8 @@ func (bbp skipTestNewContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.s).MarshalBebopTo(buf[at:]) - tmp8858 := (*bbp.s); at += tmp8858.Size() + tmp := (*bbp.s) + at += tmp.Size() } if bbp.after != nil { buf[at] = 2 @@ -1363,7 +1372,8 @@ func (bbp *skipTestNewContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp8865 := ((*bbp.s)); at += tmp8865.Size() + tmp := ((*bbp.s)) + at += tmp.Size() case 2: at += 1 bbp.after = new(int32) @@ -1388,7 +1398,8 @@ func (bbp *skipTestNewContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.s = new(skipTestNew) (*bbp.s) = mustMakeskipTestNewFromBytes(buf[at:]) - tmp8870 := ((*bbp.s)); at += tmp8870.Size() + tmp := ((*bbp.s)) + at += tmp.Size() case 2: at += 1 bbp.after = new(int32) @@ -1434,7 +1445,7 @@ func (bbp *skipTestNewContainer) DecodeBebop(ior io.Reader) (err error) { bbp.after = new(int32) *bbp.after = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1444,7 +1455,8 @@ func (bbp skipTestNewContainer) Size() int { bodyLen := 5 if bbp.s != nil { bodyLen += 1 - tmp8884 := (*bbp.s); bodyLen += tmp8884.Size() + tmp := (*bbp.s) + bodyLen += tmp.Size() } if bbp.after != nil { bodyLen += 1 @@ -1459,7 +1471,7 @@ func (bbp skipTestNewContainer) MarshalBebop() []byte { return buf } -func makeskipTestNewContainer(r iohelp.ErrorReader) (skipTestNewContainer, error) { +func makeskipTestNewContainer(r *iohelp.ErrorReader) (skipTestNewContainer, error) { v := skipTestNewContainer{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/map_types.go b/testdata/generated-private/map_types.go index 6e220f5..d3c5800 100644 --- a/testdata/generated-private/map_types.go +++ b/testdata/generated-private/map_types.go @@ -74,7 +74,7 @@ func (bbp s) MarshalBebop() []byte { return buf } -func makes(r iohelp.ErrorReader) (s, error) { +func makes(r *iohelp.ErrorReader) (s, error) { v := s{} err := v.DecodeBebop(r) return v, err @@ -164,7 +164,8 @@ func (bbp someMaps) MarshalBebopTo(buf []byte) int { iohelp.WriteBoolBytes(buf[at:], k4) at += 1 (v4).MarshalBebopTo(buf[at:]) - tmp7051 := (v4); at += tmp7051.Size() + tmp := (v4) + at += tmp.Size() } } } @@ -192,7 +193,8 @@ func (bbp someMaps) MarshalBebopTo(buf []byte) int { iohelp.WriteGUIDBytes(buf[at:], k1) at += 16 (v1).MarshalBebopTo(buf[at:]) - tmp7097 := (v1); at += tmp7097.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -273,7 +275,8 @@ func (bbp *someMaps) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7194 := (((((bbp.m3)[i1])[k2])[i3])[k4]); at += tmp7194.Size() + tmp := (((((bbp.m3)[i1])[k2])[i3])[k4]) + at += tmp.Size() } } } @@ -320,7 +323,8 @@ func (bbp *someMaps) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7248 := ((bbp.m5)[k1]); at += tmp7248.Size() + tmp := ((bbp.m5)[k1]) + at += tmp.Size() } return nil } @@ -371,7 +375,8 @@ func (bbp *someMaps) MustUnmarshalBebop(buf []byte) { k4 := iohelp.ReadBoolBytes(buf[at:]) at += 1 ((((bbp.m3)[i1])[k2])[i3])[k4] = mustMakesFromBytes(buf[at:]) - tmp7295 := (((((bbp.m3)[i1])[k2])[i3])[k4]); at += tmp7295.Size() + tmp := (((((bbp.m3)[i1])[k2])[i3])[k4]) + at += tmp.Size() } } } @@ -400,7 +405,8 @@ func (bbp *someMaps) MustUnmarshalBebop(buf []byte) { k1 := iohelp.ReadGUIDBytes(buf[at:]) at += 16 (bbp.m5)[k1] = mustMakemFromBytes(buf[at:]) - tmp7326 := ((bbp.m5)[k1]); at += tmp7326.Size() + tmp := ((bbp.m5)[k1]) + at += tmp.Size() } } @@ -553,7 +559,8 @@ func (bbp someMaps) Size() int { bodyLen += 4 for _, v4 := range elem { bodyLen += 1 - tmp8614 := (v4); bodyLen += tmp8614.Size() + tmp := (v4) + bodyLen += tmp.Size() } } } @@ -570,7 +577,8 @@ func (bbp someMaps) Size() int { bodyLen += 4 for _, v1 := range bbp.m5 { bodyLen += 16 - tmp8644 := (v1); bodyLen += tmp8644.Size() + tmp := (v1) + bodyLen += tmp.Size() } return bodyLen } @@ -581,7 +589,7 @@ func (bbp someMaps) MarshalBebop() []byte { return buf } -func makesomeMaps(r iohelp.ErrorReader) (someMaps, error) { +func makesomeMaps(r *iohelp.ErrorReader) (someMaps, error) { v := someMaps{} err := v.DecodeBebop(r) return v, err @@ -703,7 +711,7 @@ func (bbp *m) DecodeBebop(ior io.Reader) (err error) { bbp.b = new(float64) *bbp.b = iohelp.ReadFloat64(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -728,7 +736,7 @@ func (bbp m) MarshalBebop() []byte { return buf } -func makem(r iohelp.ErrorReader) (m, error) { +func makem(r *iohelp.ErrorReader) (m, error) { v := m{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/message_1.go b/testdata/generated-private/message_1.go index 44ea596..689a24c 100644 --- a/testdata/generated-private/message_1.go +++ b/testdata/generated-private/message_1.go @@ -139,7 +139,7 @@ func (bbp *exampleMessage) DecodeBebop(ior io.Reader) (err error) { bbp.z = new(int32) *bbp.z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -168,7 +168,7 @@ func (bbp exampleMessage) MarshalBebop() []byte { return buf } -func makeexampleMessage(r iohelp.ErrorReader) (exampleMessage, error) { +func makeexampleMessage(r *iohelp.ErrorReader) (exampleMessage, error) { v := exampleMessage{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/message_map.go b/testdata/generated-private/message_map.go index 69b1003..a6f0813 100644 --- a/testdata/generated-private/message_map.go +++ b/testdata/generated-private/message_map.go @@ -119,7 +119,7 @@ func (bbp *readOnlyMap) DecodeBebop(ior io.Reader) (err error) { (*bbp.vals)[k3] = iohelp.ReadUint8(r) } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -144,7 +144,7 @@ func (bbp readOnlyMap) MarshalBebop() []byte { return buf } -func makereadOnlyMap(r iohelp.ErrorReader) (readOnlyMap, error) { +func makereadOnlyMap(r *iohelp.ErrorReader) (readOnlyMap, error) { v := readOnlyMap{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/msgpack_comparison.go b/testdata/generated-private/msgpack_comparison.go index e0fb488..ececf2d 100644 --- a/testdata/generated-private/msgpack_comparison.go +++ b/testdata/generated-private/msgpack_comparison.go @@ -404,7 +404,7 @@ func (bbp msgpackComparison) MarshalBebop() []byte { return buf } -func makemsgpackComparison(r iohelp.ErrorReader) (msgpackComparison, error) { +func makemsgpackComparison(r *iohelp.ErrorReader) (msgpackComparison, error) { v := msgpackComparison{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/request.go b/testdata/generated-private/request.go index eb6bc9d..a5ed846 100644 --- a/testdata/generated-private/request.go +++ b/testdata/generated-private/request.go @@ -94,7 +94,7 @@ func (bbp furniture) MarshalBebop() []byte { return buf } -func makefurniture(r iohelp.ErrorReader) (furniture, error) { +func makefurniture(r *iohelp.ErrorReader) (furniture, error) { v := furniture{} err := v.DecodeBebop(r) return v, err @@ -150,7 +150,8 @@ func (bbp requestResponse) MarshalBebopTo(buf []byte) int { at += 4 for _, v1 := range bbp.availableFurniture { (v1).MarshalBebopTo(buf[at:]) - tmp6673 := (v1); at += tmp6673.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -167,7 +168,8 @@ func (bbp *requestResponse) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6705 := ((bbp.availableFurniture)[i1]); at += tmp6705.Size() + tmp := ((bbp.availableFurniture)[i1]) + at += tmp.Size() } return nil } @@ -178,7 +180,8 @@ func (bbp *requestResponse) MustUnmarshalBebop(buf []byte) { at += 4 for i1 := range bbp.availableFurniture { (bbp.availableFurniture)[i1] = mustMakefurnitureFromBytes(buf[at:]) - tmp6710 := ((bbp.availableFurniture)[i1]); at += tmp6710.Size() + tmp := ((bbp.availableFurniture)[i1]) + at += tmp.Size() } } @@ -210,7 +213,8 @@ func (bbp requestResponse) Size() int { bodyLen := 0 bodyLen += 4 for _, elem := range bbp.availableFurniture { - tmp6749 := (elem); bodyLen += tmp6749.Size() + tmp := (elem) + bodyLen += tmp.Size() } return bodyLen } @@ -221,7 +225,7 @@ func (bbp requestResponse) MarshalBebop() []byte { return buf } -func makerequestResponse(r iohelp.ErrorReader) (requestResponse, error) { +func makerequestResponse(r *iohelp.ErrorReader) (requestResponse, error) { v := requestResponse{} err := v.DecodeBebop(r) return v, err @@ -345,7 +349,7 @@ func (bbp *requestCatalog) DecodeBebop(ior io.Reader) (err error) { bbp.secretTunnel = new(string) *bbp.secretTunnel = iohelp.ReadString(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -366,7 +370,7 @@ func (bbp requestCatalog) MarshalBebop() []byte { return buf } -func makerequestCatalog(r iohelp.ErrorReader) (requestCatalog, error) { +func makerequestCatalog(r *iohelp.ErrorReader) (requestCatalog, error) { v := requestCatalog{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/server.go b/testdata/generated-private/server.go index 125e7ba..a8c26f4 100644 --- a/testdata/generated-private/server.go +++ b/testdata/generated-private/server.go @@ -63,7 +63,7 @@ func (bbp print) MarshalBebop() []byte { return buf } -func makeprint(r iohelp.ErrorReader) (print, error) { +func makeprint(r *iohelp.ErrorReader) (print, error) { v := print{} err := v.DecodeBebop(r) return v, err @@ -147,7 +147,7 @@ func (bbp add) MarshalBebop() []byte { return buf } -func makeadd(r iohelp.ErrorReader) (add, error) { +func makeadd(r *iohelp.ErrorReader) (add, error) { v := add{} err := v.DecodeBebop(r) return v, err @@ -218,7 +218,7 @@ func (bbp addResponse) MarshalBebop() []byte { return buf } -func makeaddResponse(r iohelp.ErrorReader) (addResponse, error) { +func makeaddResponse(r *iohelp.ErrorReader) (addResponse, error) { v := addResponse{} err := v.DecodeBebop(r) return v, err @@ -252,7 +252,8 @@ func (bbp printRequest) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.print).MarshalBebopTo(buf[at:]) - tmp8239 := (*bbp.print); at += tmp8239.Size() + tmp := (*bbp.print) + at += tmp.Size() } return at } @@ -270,7 +271,8 @@ func (bbp *printRequest) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp8241 := ((*bbp.print)); at += tmp8241.Size() + tmp := ((*bbp.print)) + at += tmp.Size() default: return nil } @@ -287,7 +289,8 @@ func (bbp *printRequest) MustUnmarshalBebop(buf []byte) { at += 1 bbp.print = new(print) (*bbp.print) = mustMakeprintFromBytes(buf[at:]) - tmp8252 := ((*bbp.print)); at += tmp8252.Size() + tmp := ((*bbp.print)) + at += tmp.Size() default: return } @@ -321,7 +324,7 @@ func (bbp *printRequest) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -331,7 +334,8 @@ func (bbp printRequest) Size() int { bodyLen := 5 if bbp.print != nil { bodyLen += 1 - tmp8286 := (*bbp.print); bodyLen += tmp8286.Size() + tmp := (*bbp.print) + bodyLen += tmp.Size() } return bodyLen } @@ -342,7 +346,7 @@ func (bbp printRequest) MarshalBebop() []byte { return buf } -func makeprintRequest(r iohelp.ErrorReader) (printRequest, error) { +func makeprintRequest(r *iohelp.ErrorReader) (printRequest, error) { v := printRequest{} err := v.DecodeBebop(r) return v, err @@ -376,7 +380,8 @@ func (bbp addRequest) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.add).MarshalBebopTo(buf[at:]) - tmp8350 := (*bbp.add); at += tmp8350.Size() + tmp := (*bbp.add) + at += tmp.Size() } return at } @@ -394,7 +399,8 @@ func (bbp *addRequest) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp8384 := ((*bbp.add)); at += tmp8384.Size() + tmp := ((*bbp.add)) + at += tmp.Size() default: return nil } @@ -411,7 +417,8 @@ func (bbp *addRequest) MustUnmarshalBebop(buf []byte) { at += 1 bbp.add = new(add) (*bbp.add) = mustMakeaddFromBytes(buf[at:]) - tmp8410 := ((*bbp.add)); at += tmp8410.Size() + tmp := ((*bbp.add)) + at += tmp.Size() default: return } @@ -445,7 +452,7 @@ func (bbp *addRequest) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -455,7 +462,8 @@ func (bbp addRequest) Size() int { bodyLen := 5 if bbp.add != nil { bodyLen += 1 - tmp8527 := (*bbp.add); bodyLen += tmp8527.Size() + tmp := (*bbp.add) + bodyLen += tmp.Size() } return bodyLen } @@ -466,7 +474,7 @@ func (bbp addRequest) MarshalBebop() []byte { return buf } -func makeaddRequest(r iohelp.ErrorReader) (addRequest, error) { +func makeaddRequest(r *iohelp.ErrorReader) (addRequest, error) { v := addRequest{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/tags.go b/testdata/generated-private/tags.go index 0341031..97db3d7 100644 --- a/testdata/generated-private/tags.go +++ b/testdata/generated-private/tags.go @@ -63,7 +63,7 @@ func (bbp taggedStruct) MarshalBebop() []byte { return buf } -func maketaggedStruct(r iohelp.ErrorReader) (taggedStruct, error) { +func maketaggedStruct(r *iohelp.ErrorReader) (taggedStruct, error) { v := taggedStruct{} err := v.DecodeBebop(r) return v, err @@ -158,7 +158,7 @@ func (bbp *taggedMessage) DecodeBebop(ior io.Reader) (err error) { bbp.bar = new(uint8) *bbp.bar = iohelp.ReadUint8(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -179,7 +179,7 @@ func (bbp taggedMessage) MarshalBebop() []byte { return buf } -func maketaggedMessage(r iohelp.ErrorReader) (taggedMessage, error) { +func maketaggedMessage(r *iohelp.ErrorReader) (taggedMessage, error) { v := taggedMessage{} err := v.DecodeBebop(r) return v, err @@ -250,7 +250,7 @@ func (bbp taggedSubStruct) MarshalBebop() []byte { return buf } -func maketaggedSubStruct(r iohelp.ErrorReader) (taggedSubStruct, error) { +func maketaggedSubStruct(r *iohelp.ErrorReader) (taggedSubStruct, error) { v := taggedSubStruct{} err := v.DecodeBebop(r) return v, err @@ -282,7 +282,8 @@ func (bbp taggedUnion) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.taggedSubStruct).MarshalBebopTo(buf[at:]) - tmp6116 := (*bbp.taggedSubStruct); at += tmp6116.Size() + tmp := (*bbp.taggedSubStruct) + at += tmp.Size() return at } return at @@ -304,7 +305,8 @@ func (bbp *taggedUnion) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6135 := ((*bbp.taggedSubStruct)); at += tmp6135.Size() + tmp := ((*bbp.taggedSubStruct)) + at += tmp.Size() return nil default: return nil @@ -322,7 +324,8 @@ func (bbp *taggedUnion) MustUnmarshalBebop(buf []byte) { at += 1 bbp.taggedSubStruct = new(taggedSubStruct) (*bbp.taggedSubStruct) = mustMaketaggedSubStructFromBytes(buf[at:]) - tmp6144 := ((*bbp.taggedSubStruct)); at += tmp6144.Size() + tmp := ((*bbp.taggedSubStruct)) + at += tmp.Size() return default: return @@ -356,10 +359,10 @@ func (bbp *taggedUnion) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -369,7 +372,8 @@ func (bbp taggedUnion) Size() int { bodyLen := 4 if bbp.taggedSubStruct != nil { bodyLen += 1 - tmp6382 := (*bbp.taggedSubStruct); bodyLen += tmp6382.Size() + tmp := (*bbp.taggedSubStruct) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -381,7 +385,7 @@ func (bbp taggedUnion) MarshalBebop() []byte { return buf } -func maketaggedUnion(r iohelp.ErrorReader) (taggedUnion, error) { +func maketaggedUnion(r *iohelp.ErrorReader) (taggedUnion, error) { v := taggedUnion{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/typed_enums.go b/testdata/generated-private/typed_enums.go index a3a1db8..335496c 100644 --- a/testdata/generated-private/typed_enums.go +++ b/testdata/generated-private/typed_enums.go @@ -174,7 +174,7 @@ func (bbp usesAllEnums) MarshalBebop() []byte { return buf } -func makeusesAllEnums(r iohelp.ErrorReader) (usesAllEnums, error) { +func makeusesAllEnums(r *iohelp.ErrorReader) (usesAllEnums, error) { v := usesAllEnums{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/union.go b/testdata/generated-private/union.go index 366dc49..88fe897 100644 --- a/testdata/generated-private/union.go +++ b/testdata/generated-private/union.go @@ -85,7 +85,7 @@ func (bbp *a) DecodeBebop(ior io.Reader) (err error) { bbp.b = new(uint32) *bbp.b = iohelp.ReadUint32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -106,7 +106,7 @@ func (bbp a) MarshalBebop() []byte { return buf } -func makea(r iohelp.ErrorReader) (a, error) { +func makea(r *iohelp.ErrorReader) (a, error) { v := a{} err := v.DecodeBebop(r) return v, err @@ -180,7 +180,7 @@ func (bbp b) MarshalBebop() []byte { return buf } -func makeb(r iohelp.ErrorReader) (b, error) { +func makeb(r *iohelp.ErrorReader) (b, error) { v := b{} err := v.DecodeBebop(r) return v, err @@ -230,7 +230,7 @@ func (bbp c) MarshalBebop() []byte { return []byte{} } -func makec(r iohelp.ErrorReader) (c, error) { +func makec(r *iohelp.ErrorReader) (c, error) { return c{}, nil } @@ -263,21 +263,24 @@ func (bbp u) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.a).MarshalBebopTo(buf[at:]) - tmp7083 := (*bbp.a); at += tmp7083.Size() + tmp := (*bbp.a) + at += tmp.Size() return at } if bbp.b != nil { buf[at] = 2 at++ (*bbp.b).MarshalBebopTo(buf[at:]) - tmp7100 := (*bbp.b); at += tmp7100.Size() + tmp := (*bbp.b) + at += tmp.Size() return at } if bbp.c != nil { buf[at] = 3 at++ (*bbp.c).MarshalBebopTo(buf[at:]) - tmp7109 := (*bbp.c); at += tmp7109.Size() + tmp := (*bbp.c) + at += tmp.Size() return at } return at @@ -299,7 +302,8 @@ func (bbp *u) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7127 := ((*bbp.a)); at += tmp7127.Size() + tmp := ((*bbp.a)) + at += tmp.Size() return nil case 2: at += 1 @@ -308,7 +312,8 @@ func (bbp *u) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7134 := ((*bbp.b)); at += tmp7134.Size() + tmp := ((*bbp.b)) + at += tmp.Size() return nil case 3: at += 1 @@ -317,7 +322,8 @@ func (bbp *u) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7140 := ((*bbp.c)); at += tmp7140.Size() + tmp := ((*bbp.c)) + at += tmp.Size() return nil default: return nil @@ -335,19 +341,22 @@ func (bbp *u) MustUnmarshalBebop(buf []byte) { at += 1 bbp.a = new(a) (*bbp.a) = mustMakeaFromBytes(buf[at:]) - tmp7147 := ((*bbp.a)); at += tmp7147.Size() + tmp := ((*bbp.a)) + at += tmp.Size() return case 2: at += 1 bbp.b = new(b) (*bbp.b) = mustMakebFromBytes(buf[at:]) - tmp7151 := ((*bbp.b)); at += tmp7151.Size() + tmp := ((*bbp.b)) + at += tmp.Size() return case 3: at += 1 bbp.c = new(c) (*bbp.c) = mustMakecFromBytes(buf[at:]) - tmp7154 := ((*bbp.c)); at += tmp7154.Size() + tmp := ((*bbp.c)) + at += tmp.Size() return default: return @@ -397,7 +406,7 @@ func (bbp *u) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.b = new(b) @@ -405,7 +414,7 @@ func (bbp *u) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 3: bbp.c = new(c) @@ -413,10 +422,10 @@ func (bbp *u) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -426,17 +435,20 @@ func (bbp u) Size() int { bodyLen := 4 if bbp.a != nil { bodyLen += 1 - tmp7218 := (*bbp.a); bodyLen += tmp7218.Size() + tmp := (*bbp.a) + bodyLen += tmp.Size() return bodyLen } if bbp.b != nil { bodyLen += 1 - tmp7228 := (*bbp.b); bodyLen += tmp7228.Size() + tmp := (*bbp.b) + bodyLen += tmp.Size() return bodyLen } if bbp.c != nil { bodyLen += 1 - tmp7238 := (*bbp.c); bodyLen += tmp7238.Size() + tmp := (*bbp.c) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -448,7 +460,7 @@ func (bbp u) MarshalBebop() []byte { return buf } -func makeu(r iohelp.ErrorReader) (u, error) { +func makeu(r *iohelp.ErrorReader) (u, error) { v := u{} err := v.DecodeBebop(r) return v, err @@ -478,7 +490,8 @@ func (bbp cons) MarshalBebopTo(buf []byte) int { iohelp.WriteUint32Bytes(buf[at:], bbp.head) at += 4 (bbp.tail).MarshalBebopTo(buf[at:]) - tmp7271 := (bbp.tail); at += tmp7271.Size() + tmp := (bbp.tail) + at += tmp.Size() return at } @@ -493,7 +506,8 @@ func (bbp *cons) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7284 := (bbp.tail); at += tmp7284.Size() + tmp := (bbp.tail) + at += tmp.Size() return nil } @@ -502,7 +516,8 @@ func (bbp *cons) MustUnmarshalBebop(buf []byte) { bbp.head = iohelp.ReadUint32Bytes(buf[at:]) at += 4 bbp.tail = mustMakelistFromBytes(buf[at:]) - tmp7291 := (bbp.tail); at += tmp7291.Size() + tmp := (bbp.tail) + at += tmp.Size() } func (bbp cons) EncodeBebop(iow io.Writer) (err error) { @@ -528,7 +543,8 @@ func (bbp *cons) DecodeBebop(ior io.Reader) (err error) { func (bbp cons) Size() int { bodyLen := 0 bodyLen += 4 - tmp7314 := (bbp.tail); bodyLen += tmp7314.Size() + tmp := (bbp.tail) + bodyLen += tmp.Size() return bodyLen } @@ -538,7 +554,7 @@ func (bbp cons) MarshalBebop() []byte { return buf } -func makecons(r iohelp.ErrorReader) (cons, error) { +func makecons(r *iohelp.ErrorReader) (cons, error) { v := cons{} err := v.DecodeBebop(r) return v, err @@ -589,7 +605,7 @@ func (bbp null) MarshalBebop() []byte { return []byte{} } -func makenull(r iohelp.ErrorReader) (null, error) { +func makenull(r *iohelp.ErrorReader) (null, error) { return null{}, nil } @@ -616,14 +632,16 @@ func (bbp list) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.cons).MarshalBebopTo(buf[at:]) - tmp7347 := (*bbp.cons); at += tmp7347.Size() + tmp := (*bbp.cons) + at += tmp.Size() return at } if bbp.null != nil { buf[at] = 2 at++ (*bbp.null).MarshalBebopTo(buf[at:]) - tmp7354 := (*bbp.null); at += tmp7354.Size() + tmp := (*bbp.null) + at += tmp.Size() return at } return at @@ -645,7 +663,8 @@ func (bbp *list) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7358 := ((*bbp.cons)); at += tmp7358.Size() + tmp := ((*bbp.cons)) + at += tmp.Size() return nil case 2: at += 1 @@ -654,7 +673,8 @@ func (bbp *list) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp7359 := ((*bbp.null)); at += tmp7359.Size() + tmp := ((*bbp.null)) + at += tmp.Size() return nil default: return nil @@ -672,13 +692,15 @@ func (bbp *list) MustUnmarshalBebop(buf []byte) { at += 1 bbp.cons = new(cons) (*bbp.cons) = mustMakeconsFromBytes(buf[at:]) - tmp7362 := ((*bbp.cons)); at += tmp7362.Size() + tmp := ((*bbp.cons)) + at += tmp.Size() return case 2: at += 1 bbp.null = new(null) (*bbp.null) = mustMakenullFromBytes(buf[at:]) - tmp7367 := ((*bbp.null)); at += tmp7367.Size() + tmp := ((*bbp.null)) + at += tmp.Size() return default: return @@ -720,7 +742,7 @@ func (bbp *list) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.null = new(null) @@ -728,10 +750,10 @@ func (bbp *list) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -741,12 +763,14 @@ func (bbp list) Size() int { bodyLen := 4 if bbp.cons != nil { bodyLen += 1 - tmp7394 := (*bbp.cons); bodyLen += tmp7394.Size() + tmp := (*bbp.cons) + bodyLen += tmp.Size() return bodyLen } if bbp.null != nil { bodyLen += 1 - tmp7399 := (*bbp.null); bodyLen += tmp7399.Size() + tmp := (*bbp.null) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -758,7 +782,7 @@ func (bbp list) MarshalBebop() []byte { return buf } -func makelist(r iohelp.ErrorReader) (list, error) { +func makelist(r *iohelp.ErrorReader) (list, error) { v := list{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated-private/union_field.go b/testdata/generated-private/union_field.go index 714c427..457c376 100644 --- a/testdata/generated-private/union_field.go +++ b/testdata/generated-private/union_field.go @@ -22,7 +22,8 @@ func (bbp withUnionField) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.test).MarshalBebopTo(buf[at:]) - tmp6269 := (*bbp.test); at += tmp6269.Size() + tmp := (*bbp.test) + at += tmp.Size() } return at } @@ -40,7 +41,8 @@ func (bbp *withUnionField) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6277 := ((*bbp.test)); at += tmp6277.Size() + tmp := ((*bbp.test)) + at += tmp.Size() default: return nil } @@ -57,7 +59,8 @@ func (bbp *withUnionField) MustUnmarshalBebop(buf []byte) { at += 1 bbp.test = new(list2) (*bbp.test) = mustMakelist2FromBytes(buf[at:]) - tmp6280 := ((*bbp.test)); at += tmp6280.Size() + tmp := ((*bbp.test)) + at += tmp.Size() default: return } @@ -91,7 +94,7 @@ func (bbp *withUnionField) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -101,7 +104,8 @@ func (bbp withUnionField) Size() int { bodyLen := 5 if bbp.test != nil { bodyLen += 1 - tmp6296 := (*bbp.test); bodyLen += tmp6296.Size() + tmp := (*bbp.test) + bodyLen += tmp.Size() } return bodyLen } @@ -112,7 +116,7 @@ func (bbp withUnionField) MarshalBebop() []byte { return buf } -func makewithUnionField(r iohelp.ErrorReader) (withUnionField, error) { +func makewithUnionField(r *iohelp.ErrorReader) (withUnionField, error) { v := withUnionField{} err := v.DecodeBebop(r) return v, err @@ -190,7 +194,7 @@ func (bbp cons2) MarshalBebop() []byte { return buf } -func makecons2(r iohelp.ErrorReader) (cons2, error) { +func makecons2(r *iohelp.ErrorReader) (cons2, error) { v := cons2{} err := v.DecodeBebop(r) return v, err @@ -241,7 +245,7 @@ func (bbp nil2) MarshalBebop() []byte { return []byte{} } -func makenil2(r iohelp.ErrorReader) (nil2, error) { +func makenil2(r *iohelp.ErrorReader) (nil2, error) { return nil2{}, nil } @@ -268,14 +272,16 @@ func (bbp list2) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.cons2).MarshalBebopTo(buf[at:]) - tmp6437 := (*bbp.cons2); at += tmp6437.Size() + tmp := (*bbp.cons2) + at += tmp.Size() return at } if bbp.nil2 != nil { buf[at] = 2 at++ (*bbp.nil2).MarshalBebopTo(buf[at:]) - tmp6449 := (*bbp.nil2); at += tmp6449.Size() + tmp := (*bbp.nil2) + at += tmp.Size() return at } return at @@ -297,7 +303,8 @@ func (bbp *list2) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6480 := ((*bbp.cons2)); at += tmp6480.Size() + tmp := ((*bbp.cons2)) + at += tmp.Size() return nil case 2: at += 1 @@ -306,7 +313,8 @@ func (bbp *list2) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6482 := ((*bbp.nil2)); at += tmp6482.Size() + tmp := ((*bbp.nil2)) + at += tmp.Size() return nil default: return nil @@ -324,13 +332,15 @@ func (bbp *list2) MustUnmarshalBebop(buf []byte) { at += 1 bbp.cons2 = new(cons2) (*bbp.cons2) = mustMakecons2FromBytes(buf[at:]) - tmp6493 := ((*bbp.cons2)); at += tmp6493.Size() + tmp := ((*bbp.cons2)) + at += tmp.Size() return case 2: at += 1 bbp.nil2 = new(nil2) (*bbp.nil2) = mustMakenil2FromBytes(buf[at:]) - tmp6494 := ((*bbp.nil2)); at += tmp6494.Size() + tmp := ((*bbp.nil2)) + at += tmp.Size() return default: return @@ -372,7 +382,7 @@ func (bbp *list2) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.nil2 = new(nil2) @@ -380,10 +390,10 @@ func (bbp *list2) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -393,12 +403,14 @@ func (bbp list2) Size() int { bodyLen := 4 if bbp.cons2 != nil { bodyLen += 1 - tmp6524 := (*bbp.cons2); bodyLen += tmp6524.Size() + tmp := (*bbp.cons2) + bodyLen += tmp.Size() return bodyLen } if bbp.nil2 != nil { bodyLen += 1 - tmp6529 := (*bbp.nil2); bodyLen += tmp6529.Size() + tmp := (*bbp.nil2) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -410,7 +422,7 @@ func (bbp list2) MarshalBebop() []byte { return buf } -func makelist2(r iohelp.ErrorReader) (list2, error) { +func makelist2(r *iohelp.ErrorReader) (list2, error) { v := list2{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/array_of_strings.go b/testdata/generated/array_of_strings.go index ee158ce..302064b 100644 --- a/testdata/generated/array_of_strings.go +++ b/testdata/generated/array_of_strings.go @@ -87,7 +87,7 @@ func (bbp ArrayOfStrings) MarshalBebop() []byte { return buf } -func MakeArrayOfStrings(r iohelp.ErrorReader) (ArrayOfStrings, error) { +func MakeArrayOfStrings(r *iohelp.ErrorReader) (ArrayOfStrings, error) { v := ArrayOfStrings{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/arrays.go b/testdata/generated/arrays.go index fd6c6bc..775ab05 100644 --- a/testdata/generated/arrays.go +++ b/testdata/generated/arrays.go @@ -194,7 +194,7 @@ func (bbp ArraySamples) MarshalBebop() []byte { return buf } -func MakeArraySamples(r iohelp.ErrorReader) (ArraySamples, error) { +func MakeArraySamples(r *iohelp.ErrorReader) (ArraySamples, error) { v := ArraySamples{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/basic_arrays.go b/testdata/generated/basic_arrays.go index 9d5e566..d9964ef 100644 --- a/testdata/generated/basic_arrays.go +++ b/testdata/generated/basic_arrays.go @@ -462,7 +462,7 @@ func (bbp BasicArrays) MarshalBebop() []byte { return buf } -func MakeBasicArrays(r iohelp.ErrorReader) (BasicArrays, error) { +func MakeBasicArrays(r *iohelp.ErrorReader) (BasicArrays, error) { v := BasicArrays{} err := v.DecodeBebop(r) return v, err @@ -555,7 +555,7 @@ func (bbp TestInt32Array) MarshalBebop() []byte { return buf } -func MakeTestInt32Array(r iohelp.ErrorReader) (TestInt32Array, error) { +func MakeTestInt32Array(r *iohelp.ErrorReader) (TestInt32Array, error) { v := TestInt32Array{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/basic_types.go b/testdata/generated/basic_types.go index 76316c2..1c4dc7b 100644 --- a/testdata/generated/basic_types.go +++ b/testdata/generated/basic_types.go @@ -228,7 +228,7 @@ func (bbp BasicTypes) MarshalBebop() []byte { return buf } -func MakeBasicTypes(r iohelp.ErrorReader) (BasicTypes, error) { +func MakeBasicTypes(r *iohelp.ErrorReader) (BasicTypes, error) { v := BasicTypes{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/bench_test.go b/testdata/generated/bench_test.go new file mode 100644 index 0000000..9301596 --- /dev/null +++ b/testdata/generated/bench_test.go @@ -0,0 +1,84 @@ +package generated_test + +import ( + "bytes" + "math/rand" + "testing" + + "github.com/200sc/bebop/testdata/generated" +) + +func BenchmarkArraySamplesMarshalBebopTo(b *testing.B) { + b.StopTimer() + b1 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b1[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b1[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b1[i][j][k] = byte(rand.Intn(255)) + } + } + } + b2 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b2[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b2[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b2[i][j][k] = byte(rand.Intn(255)) + } + } + } + v := generated.ArraySamples{ + Bytes: b1, + Bytes2: b2, + } + out := make([]byte, v.Size()) + + b.ReportAllocs() + b.StartTimer() + for i := 0; i < b.N; i++ { + v.MarshalBebopTo(out) + } + benchOut = out +} + +var benchOut []byte + +func BenchmarkArraySamplesEncodeBebop(b *testing.B) { + b.StopTimer() + b1 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b1[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b1[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b1[i][j][k] = byte(rand.Intn(255)) + } + } + } + b2 := make([][][]byte, 100) + for i := 0; i < 100; i++ { + b2[i] = make([][]byte, 100) + for j := 0; j < 100; j++ { + b2[i][j] = make([]byte, 10) + for k := 0; k < 10; k++ { + b2[i][j][k] = byte(rand.Intn(255)) + } + } + } + v := generated.ArraySamples{ + Bytes: b1, + Bytes2: b2, + } + + w := bytes.NewBuffer(make([]byte, 0, v.Size())) + + b.ReportAllocs() + b.StartTimer() + for i := 0; i < b.N; i++ { + v.EncodeBebop(w) + } + benchOut = w.Bytes() +} diff --git a/testdata/generated/date.go b/testdata/generated/date.go index f6bd6ae..cbde353 100644 --- a/testdata/generated/date.go +++ b/testdata/generated/date.go @@ -129,7 +129,7 @@ func (bbp *MyObj) DecodeBebop(ior io.Reader) (err error) { bbp.End = new(time.Time) *bbp.End = iohelp.ReadDate(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -154,7 +154,7 @@ func (bbp MyObj) MarshalBebop() []byte { return buf } -func MakeMyObj(r iohelp.ErrorReader) (MyObj, error) { +func MakeMyObj(r *iohelp.ErrorReader) (MyObj, error) { v := MyObj{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/documentation.go b/testdata/generated/documentation.go index 0d44e27..ecdc2af 100644 --- a/testdata/generated/documentation.go +++ b/testdata/generated/documentation.go @@ -83,7 +83,7 @@ func (bbp DocS) MarshalBebop() []byte { return buf } -func MakeDocS(r iohelp.ErrorReader) (DocS, error) { +func MakeDocS(r *iohelp.ErrorReader) (DocS, error) { v := DocS{} err := v.DecodeBebop(r) return v, err @@ -169,7 +169,7 @@ func (bbp *DepM) DecodeBebop(ior io.Reader) (err error) { bbp.X = new(int32) *bbp.X = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -186,7 +186,7 @@ func (bbp DepM) MarshalBebop() []byte { return buf } -func MakeDepM(r iohelp.ErrorReader) (DepM, error) { +func MakeDepM(r *iohelp.ErrorReader) (DepM, error) { v := DepM{} err := v.DecodeBebop(r) return v, err @@ -320,7 +320,7 @@ func (bbp *DocM) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(int32) *bbp.Z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -341,7 +341,7 @@ func (bbp DocM) MarshalBebop() []byte { return buf } -func MakeDocM(r iohelp.ErrorReader) (DocM, error) { +func MakeDocM(r *iohelp.ErrorReader) (DocM, error) { v := DocM{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/foo.go b/testdata/generated/foo.go index a11f0ea..4d19789 100644 --- a/testdata/generated/foo.go +++ b/testdata/generated/foo.go @@ -17,7 +17,8 @@ type Foo struct { func (bbp Foo) MarshalBebopTo(buf []byte) int { at := 0 (bbp.Bar).MarshalBebopTo(buf[at:]) - tmp1277 := (bbp.Bar); at += tmp1277.Size() + tmp := (bbp.Bar) + at += tmp.Size() return at } @@ -27,14 +28,16 @@ func (bbp *Foo) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1278 := (bbp.Bar); at += tmp1278.Size() + tmp := (bbp.Bar) + at += tmp.Size() return nil } func (bbp *Foo) MustUnmarshalBebop(buf []byte) { at := 0 bbp.Bar = MustMakeBarFromBytes(buf[at:]) - tmp1279 := (bbp.Bar); at += tmp1279.Size() + tmp := (bbp.Bar) + at += tmp.Size() } func (bbp Foo) EncodeBebop(iow io.Writer) (err error) { @@ -57,7 +60,8 @@ func (bbp *Foo) DecodeBebop(ior io.Reader) (err error) { func (bbp Foo) Size() int { bodyLen := 0 - tmp1292 := (bbp.Bar); bodyLen += tmp1292.Size() + tmp := (bbp.Bar) + bodyLen += tmp.Size() return bodyLen } @@ -67,7 +71,7 @@ func (bbp Foo) MarshalBebop() []byte { return buf } -func MakeFoo(r iohelp.ErrorReader) (Foo, error) { +func MakeFoo(r *iohelp.ErrorReader) (Foo, error) { v := Foo{} err := v.DecodeBebop(r) return v, err @@ -216,7 +220,7 @@ func (bbp *Bar) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(float64) *bbp.Z = iohelp.ReadFloat64(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -245,7 +249,7 @@ func (bbp Bar) MarshalBebop() []byte { return buf } -func MakeBar(r iohelp.ErrorReader) (Bar, error) { +func MakeBar(r *iohelp.ErrorReader) (Bar, error) { v := Bar{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/import_b/import_b.go b/testdata/generated/import_b/import_b.go index f1c7386..42b8eb5 100644 --- a/testdata/generated/import_b/import_b.go +++ b/testdata/generated/import_b/import_b.go @@ -73,7 +73,7 @@ func (bbp Test22) MarshalBebop() []byte { return buf } -func MakeTest22(r iohelp.ErrorReader) (Test22, error) { +func MakeTest22(r *iohelp.ErrorReader) (Test22, error) { v := Test22{} err := v.DecodeBebop(r) return v, err @@ -159,7 +159,7 @@ func (bbp Hello) MarshalBebop() []byte { return buf } -func MakeHello(r iohelp.ErrorReader) (Hello, error) { +func MakeHello(r *iohelp.ErrorReader) (Hello, error) { v := Hello{} err := v.DecodeBebop(r) return v, err @@ -242,7 +242,7 @@ func (bbp Musician) MarshalBebop() []byte { return buf } -func MakeMusician(r iohelp.ErrorReader) (Musician, error) { +func MakeMusician(r *iohelp.ErrorReader) (Musician, error) { v := Musician{} err := v.DecodeBebop(r) return v, err @@ -292,7 +292,8 @@ func (bbp Library) MarshalBebopTo(buf []byte) int { iohelp.WriteGUIDBytes(buf[at:], k1) at += 16 (v1).MarshalBebopTo(buf[at:]) - tmp5291 := (v1); at += tmp5291.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -312,7 +313,8 @@ func (bbp *Library) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5301 := ((bbp.Songs)[k1]); at += tmp5301.Size() + tmp := ((bbp.Songs)[k1]) + at += tmp.Size() } return nil } @@ -326,7 +328,8 @@ func (bbp *Library) MustUnmarshalBebop(buf []byte) { k1 := iohelp.ReadGUIDBytes(buf[at:]) at += 16 (bbp.Songs)[k1] = MustMakeSongFromBytes(buf[at:]) - tmp5308 := ((bbp.Songs)[k1]); at += tmp5308.Size() + tmp := ((bbp.Songs)[k1]) + at += tmp.Size() } } @@ -362,7 +365,8 @@ func (bbp Library) Size() int { bodyLen += 4 for _, v1 := range bbp.Songs { bodyLen += 16 - tmp5330 := (v1); bodyLen += tmp5330.Size() + tmp := (v1) + bodyLen += tmp.Size() } return bodyLen } @@ -373,7 +377,7 @@ func (bbp Library) MarshalBebop() []byte { return buf } -func MakeLibrary(r iohelp.ErrorReader) (Library, error) { +func MakeLibrary(r *iohelp.ErrorReader) (Library, error) { v := Library{} err := v.DecodeBebop(r) return v, err @@ -466,7 +470,7 @@ func (bbp Int32s) MarshalBebop() []byte { return buf } -func MakeInt32s(r iohelp.ErrorReader) (Int32s, error) { +func MakeInt32s(r *iohelp.ErrorReader) (Int32s, error) { v := Int32s{} err := v.DecodeBebop(r) return v, err @@ -559,7 +563,7 @@ func (bbp Uint32s) MarshalBebop() []byte { return buf } -func MakeUint32s(r iohelp.ErrorReader) (Uint32s, error) { +func MakeUint32s(r *iohelp.ErrorReader) (Uint32s, error) { v := Uint32s{} err := v.DecodeBebop(r) return v, err @@ -652,7 +656,7 @@ func (bbp Float32s) MarshalBebop() []byte { return buf } -func MakeFloat32s(r iohelp.ErrorReader) (Float32s, error) { +func MakeFloat32s(r *iohelp.ErrorReader) (Float32s, error) { v := Float32s{} err := v.DecodeBebop(r) return v, err @@ -745,7 +749,7 @@ func (bbp Int64s) MarshalBebop() []byte { return buf } -func MakeInt64s(r iohelp.ErrorReader) (Int64s, error) { +func MakeInt64s(r *iohelp.ErrorReader) (Int64s, error) { v := Int64s{} err := v.DecodeBebop(r) return v, err @@ -838,7 +842,7 @@ func (bbp Uint64s) MarshalBebop() []byte { return buf } -func MakeUint64s(r iohelp.ErrorReader) (Uint64s, error) { +func MakeUint64s(r *iohelp.ErrorReader) (Uint64s, error) { v := Uint64s{} err := v.DecodeBebop(r) return v, err @@ -931,7 +935,7 @@ func (bbp Float64s) MarshalBebop() []byte { return buf } -func MakeFloat64s(r iohelp.ErrorReader) (Float64s, error) { +func MakeFloat64s(r *iohelp.ErrorReader) (Float64s, error) { v := Float64s{} err := v.DecodeBebop(r) return v, err @@ -1053,7 +1057,7 @@ func (bbp VideoData) MarshalBebop() []byte { return buf } -func MakeVideoData(r iohelp.ErrorReader) (VideoData, error) { +func MakeVideoData(r *iohelp.ErrorReader) (VideoData, error) { v := VideoData{} err := v.DecodeBebop(r) return v, err @@ -1103,7 +1107,8 @@ func (bbp Song) MarshalBebopTo(buf []byte) int { at += 4 for _, v2 := range *bbp.Performers { (v2).MarshalBebopTo(buf[at:]) - tmp6077 := (v2); at += tmp6077.Size() + tmp := (v2) + at += tmp.Size() } } return at @@ -1144,7 +1149,8 @@ func (bbp *Song) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6096 := (((*bbp.Performers))[i3]); at += tmp6096.Size() + tmp := (((*bbp.Performers))[i3]) + at += tmp.Size() } default: return nil @@ -1175,7 +1181,8 @@ func (bbp *Song) MustUnmarshalBebop(buf []byte) { at += 4 for i3 := range (*bbp.Performers) { ((*bbp.Performers))[i3] = MustMakeMusicianFromBytes(buf[at:]) - tmp6120 := (((*bbp.Performers))[i3]); at += tmp6120.Size() + tmp := (((*bbp.Performers))[i3]) + at += tmp.Size() } default: return @@ -1231,7 +1238,7 @@ func (bbp *Song) DecodeBebop(ior io.Reader) (err error) { } } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1251,7 +1258,8 @@ func (bbp Song) Size() int { bodyLen += 1 bodyLen += 4 for _, elem := range *bbp.Performers { - tmp6164 := (elem); bodyLen += tmp6164.Size() + tmp := (elem) + bodyLen += tmp.Size() } } return bodyLen @@ -1263,7 +1271,7 @@ func (bbp Song) MarshalBebop() []byte { return buf } -func MakeSong(r iohelp.ErrorReader) (Song, error) { +func MakeSong(r *iohelp.ErrorReader) (Song, error) { v := Song{} err := v.DecodeBebop(r) return v, err @@ -1302,7 +1310,8 @@ func (bbp MediaMessage) MarshalBebopTo(buf []byte) int { buf[at] = 2 at++ (*bbp.Data).MarshalBebopTo(buf[at:]) - tmp6177 := (*bbp.Data); at += tmp6177.Size() + tmp := (*bbp.Data) + at += tmp.Size() } return at } @@ -1325,7 +1334,8 @@ func (bbp *MediaMessage) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6225 := ((*bbp.Data)); at += tmp6225.Size() + tmp := ((*bbp.Data)) + at += tmp.Size() default: return nil } @@ -1347,7 +1357,8 @@ func (bbp *MediaMessage) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Data = new(VideoData) (*bbp.Data) = MustMakeVideoDataFromBytes(buf[at:]) - tmp6255 := ((*bbp.Data)); at += tmp6255.Size() + tmp := ((*bbp.Data)) + at += tmp.Size() default: return } @@ -1388,7 +1399,7 @@ func (bbp *MediaMessage) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1402,7 +1413,8 @@ func (bbp MediaMessage) Size() int { } if bbp.Data != nil { bodyLen += 1 - tmp6291 := (*bbp.Data); bodyLen += tmp6291.Size() + tmp := (*bbp.Data) + bodyLen += tmp.Size() } return bodyLen } @@ -1413,7 +1425,7 @@ func (bbp MediaMessage) MarshalBebop() []byte { return buf } -func MakeMediaMessage(r iohelp.ErrorReader) (MediaMessage, error) { +func MakeMediaMessage(r *iohelp.ErrorReader) (MediaMessage, error) { v := MediaMessage{} err := v.DecodeBebop(r) return v, err @@ -1536,7 +1548,7 @@ func (bbp *SkipTestOld) DecodeBebop(ior io.Reader) (err error) { bbp.Y = new(int32) *bbp.Y = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1561,7 +1573,7 @@ func (bbp SkipTestOld) MarshalBebop() []byte { return buf } -func MakeSkipTestOld(r iohelp.ErrorReader) (SkipTestOld, error) { +func MakeSkipTestOld(r *iohelp.ErrorReader) (SkipTestOld, error) { v := SkipTestOld{} err := v.DecodeBebop(r) return v, err @@ -1710,7 +1722,7 @@ func (bbp *SkipTestNew) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(int32) *bbp.Z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1739,7 +1751,7 @@ func (bbp SkipTestNew) MarshalBebop() []byte { return buf } -func MakeSkipTestNew(r iohelp.ErrorReader) (SkipTestNew, error) { +func MakeSkipTestNew(r *iohelp.ErrorReader) (SkipTestNew, error) { v := SkipTestNew{} err := v.DecodeBebop(r) return v, err @@ -1772,7 +1784,8 @@ func (bbp SkipTestOldContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.S).MarshalBebopTo(buf[at:]) - tmp6640 := (*bbp.S); at += tmp6640.Size() + tmp := (*bbp.S) + at += tmp.Size() } if bbp.After != nil { buf[at] = 2 @@ -1796,7 +1809,8 @@ func (bbp *SkipTestOldContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6690 := ((*bbp.S)); at += tmp6690.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1821,7 +1835,8 @@ func (bbp *SkipTestOldContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.S = new(SkipTestOld) (*bbp.S) = MustMakeSkipTestOldFromBytes(buf[at:]) - tmp6743 := ((*bbp.S)); at += tmp6743.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1867,7 +1882,7 @@ func (bbp *SkipTestOldContainer) DecodeBebop(ior io.Reader) (err error) { bbp.After = new(int32) *bbp.After = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1877,7 +1892,8 @@ func (bbp SkipTestOldContainer) Size() int { bodyLen := 5 if bbp.S != nil { bodyLen += 1 - tmp6779 := (*bbp.S); bodyLen += tmp6779.Size() + tmp := (*bbp.S) + bodyLen += tmp.Size() } if bbp.After != nil { bodyLen += 1 @@ -1892,7 +1908,7 @@ func (bbp SkipTestOldContainer) MarshalBebop() []byte { return buf } -func MakeSkipTestOldContainer(r iohelp.ErrorReader) (SkipTestOldContainer, error) { +func MakeSkipTestOldContainer(r *iohelp.ErrorReader) (SkipTestOldContainer, error) { v := SkipTestOldContainer{} err := v.DecodeBebop(r) return v, err @@ -1925,7 +1941,8 @@ func (bbp SkipTestNewContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.S).MarshalBebopTo(buf[at:]) - tmp6820 := (*bbp.S); at += tmp6820.Size() + tmp := (*bbp.S) + at += tmp.Size() } if bbp.After != nil { buf[at] = 2 @@ -1949,7 +1966,8 @@ func (bbp *SkipTestNewContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp6836 := ((*bbp.S)); at += tmp6836.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1974,7 +1992,8 @@ func (bbp *SkipTestNewContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.S = new(SkipTestNew) (*bbp.S) = MustMakeSkipTestNewFromBytes(buf[at:]) - tmp6853 := ((*bbp.S)); at += tmp6853.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -2020,7 +2039,7 @@ func (bbp *SkipTestNewContainer) DecodeBebop(ior io.Reader) (err error) { bbp.After = new(int32) *bbp.After = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -2030,7 +2049,8 @@ func (bbp SkipTestNewContainer) Size() int { bodyLen := 5 if bbp.S != nil { bodyLen += 1 - tmp6893 := (*bbp.S); bodyLen += tmp6893.Size() + tmp := (*bbp.S) + bodyLen += tmp.Size() } if bbp.After != nil { bodyLen += 1 @@ -2045,7 +2065,7 @@ func (bbp SkipTestNewContainer) MarshalBebop() []byte { return buf } -func MakeSkipTestNewContainer(r iohelp.ErrorReader) (SkipTestNewContainer, error) { +func MakeSkipTestNewContainer(r *iohelp.ErrorReader) (SkipTestNewContainer, error) { v := SkipTestNewContainer{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/jazz.go b/testdata/generated/jazz.go index b74740f..e381e9b 100644 --- a/testdata/generated/jazz.go +++ b/testdata/generated/jazz.go @@ -81,7 +81,7 @@ func (bbp Musician) MarshalBebop() []byte { return buf } -func MakeMusician(r iohelp.ErrorReader) (Musician, error) { +func MakeMusician(r *iohelp.ErrorReader) (Musician, error) { v := Musician{} err := v.DecodeBebop(r) return v, err @@ -131,7 +131,8 @@ func (bbp Library) MarshalBebopTo(buf []byte) int { iohelp.WriteGUIDBytes(buf[at:], k1) at += 16 (v1).MarshalBebopTo(buf[at:]) - tmp1850 := (v1); at += tmp1850.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -151,7 +152,8 @@ func (bbp *Library) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1875 := ((bbp.Songs)[k1]); at += tmp1875.Size() + tmp := ((bbp.Songs)[k1]) + at += tmp.Size() } return nil } @@ -165,7 +167,8 @@ func (bbp *Library) MustUnmarshalBebop(buf []byte) { k1 := iohelp.ReadGUIDBytes(buf[at:]) at += 16 (bbp.Songs)[k1] = MustMakeSongFromBytes(buf[at:]) - tmp1889 := ((bbp.Songs)[k1]); at += tmp1889.Size() + tmp := ((bbp.Songs)[k1]) + at += tmp.Size() } } @@ -201,7 +204,8 @@ func (bbp Library) Size() int { bodyLen += 4 for _, v1 := range bbp.Songs { bodyLen += 16 - tmp1932 := (v1); bodyLen += tmp1932.Size() + tmp := (v1) + bodyLen += tmp.Size() } return bodyLen } @@ -212,7 +216,7 @@ func (bbp Library) MarshalBebop() []byte { return buf } -func MakeLibrary(r iohelp.ErrorReader) (Library, error) { +func MakeLibrary(r *iohelp.ErrorReader) (Library, error) { v := Library{} err := v.DecodeBebop(r) return v, err @@ -262,7 +266,8 @@ func (bbp Song) MarshalBebopTo(buf []byte) int { at += 4 for _, v2 := range *bbp.Performers { (v2).MarshalBebopTo(buf[at:]) - tmp1957 := (v2); at += tmp1957.Size() + tmp := (v2) + at += tmp.Size() } } return at @@ -303,7 +308,8 @@ func (bbp *Song) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1971 := (((*bbp.Performers))[i3]); at += tmp1971.Size() + tmp := (((*bbp.Performers))[i3]) + at += tmp.Size() } default: return nil @@ -334,7 +340,8 @@ func (bbp *Song) MustUnmarshalBebop(buf []byte) { at += 4 for i3 := range (*bbp.Performers) { ((*bbp.Performers))[i3] = MustMakeMusicianFromBytes(buf[at:]) - tmp1978 := (((*bbp.Performers))[i3]); at += tmp1978.Size() + tmp := (((*bbp.Performers))[i3]) + at += tmp.Size() } default: return @@ -390,7 +397,7 @@ func (bbp *Song) DecodeBebop(ior io.Reader) (err error) { } } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -410,7 +417,8 @@ func (bbp Song) Size() int { bodyLen += 1 bodyLen += 4 for _, elem := range *bbp.Performers { - tmp2013 := (elem); bodyLen += tmp2013.Size() + tmp := (elem) + bodyLen += tmp.Size() } } return bodyLen @@ -422,7 +430,7 @@ func (bbp Song) MarshalBebop() []byte { return buf } -func MakeSong(r iohelp.ErrorReader) (Song, error) { +func MakeSong(r *iohelp.ErrorReader) (Song, error) { v := Song{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/lab.go b/testdata/generated/lab.go index 6994ba8..0c3af56 100644 --- a/testdata/generated/lab.go +++ b/testdata/generated/lab.go @@ -90,7 +90,7 @@ func (bbp Int32s) MarshalBebop() []byte { return buf } -func MakeInt32s(r iohelp.ErrorReader) (Int32s, error) { +func MakeInt32s(r *iohelp.ErrorReader) (Int32s, error) { v := Int32s{} err := v.DecodeBebop(r) return v, err @@ -183,7 +183,7 @@ func (bbp Uint32s) MarshalBebop() []byte { return buf } -func MakeUint32s(r iohelp.ErrorReader) (Uint32s, error) { +func MakeUint32s(r *iohelp.ErrorReader) (Uint32s, error) { v := Uint32s{} err := v.DecodeBebop(r) return v, err @@ -276,7 +276,7 @@ func (bbp Float32s) MarshalBebop() []byte { return buf } -func MakeFloat32s(r iohelp.ErrorReader) (Float32s, error) { +func MakeFloat32s(r *iohelp.ErrorReader) (Float32s, error) { v := Float32s{} err := v.DecodeBebop(r) return v, err @@ -369,7 +369,7 @@ func (bbp Int64s) MarshalBebop() []byte { return buf } -func MakeInt64s(r iohelp.ErrorReader) (Int64s, error) { +func MakeInt64s(r *iohelp.ErrorReader) (Int64s, error) { v := Int64s{} err := v.DecodeBebop(r) return v, err @@ -462,7 +462,7 @@ func (bbp Uint64s) MarshalBebop() []byte { return buf } -func MakeUint64s(r iohelp.ErrorReader) (Uint64s, error) { +func MakeUint64s(r *iohelp.ErrorReader) (Uint64s, error) { v := Uint64s{} err := v.DecodeBebop(r) return v, err @@ -555,7 +555,7 @@ func (bbp Float64s) MarshalBebop() []byte { return buf } -func MakeFloat64s(r iohelp.ErrorReader) (Float64s, error) { +func MakeFloat64s(r *iohelp.ErrorReader) (Float64s, error) { v := Float64s{} err := v.DecodeBebop(r) return v, err @@ -677,7 +677,7 @@ func (bbp VideoData) MarshalBebop() []byte { return buf } -func MakeVideoData(r iohelp.ErrorReader) (VideoData, error) { +func MakeVideoData(r *iohelp.ErrorReader) (VideoData, error) { v := VideoData{} err := v.DecodeBebop(r) return v, err @@ -716,7 +716,8 @@ func (bbp MediaMessage) MarshalBebopTo(buf []byte) int { buf[at] = 2 at++ (*bbp.Data).MarshalBebopTo(buf[at:]) - tmp292 := (*bbp.Data); at += tmp292.Size() + tmp := (*bbp.Data) + at += tmp.Size() } return at } @@ -739,7 +740,8 @@ func (bbp *MediaMessage) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp295 := ((*bbp.Data)); at += tmp295.Size() + tmp := ((*bbp.Data)) + at += tmp.Size() default: return nil } @@ -761,7 +763,8 @@ func (bbp *MediaMessage) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Data = new(VideoData) (*bbp.Data) = MustMakeVideoDataFromBytes(buf[at:]) - tmp297 := ((*bbp.Data)); at += tmp297.Size() + tmp := ((*bbp.Data)) + at += tmp.Size() default: return } @@ -802,7 +805,7 @@ func (bbp *MediaMessage) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -816,7 +819,8 @@ func (bbp MediaMessage) Size() int { } if bbp.Data != nil { bodyLen += 1 - tmp329 := (*bbp.Data); bodyLen += tmp329.Size() + tmp := (*bbp.Data) + bodyLen += tmp.Size() } return bodyLen } @@ -827,7 +831,7 @@ func (bbp MediaMessage) MarshalBebop() []byte { return buf } -func MakeMediaMessage(r iohelp.ErrorReader) (MediaMessage, error) { +func MakeMediaMessage(r *iohelp.ErrorReader) (MediaMessage, error) { v := MediaMessage{} err := v.DecodeBebop(r) return v, err @@ -950,7 +954,7 @@ func (bbp *SkipTestOld) DecodeBebop(ior io.Reader) (err error) { bbp.Y = new(int32) *bbp.Y = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -975,7 +979,7 @@ func (bbp SkipTestOld) MarshalBebop() []byte { return buf } -func MakeSkipTestOld(r iohelp.ErrorReader) (SkipTestOld, error) { +func MakeSkipTestOld(r *iohelp.ErrorReader) (SkipTestOld, error) { v := SkipTestOld{} err := v.DecodeBebop(r) return v, err @@ -1124,7 +1128,7 @@ func (bbp *SkipTestNew) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(int32) *bbp.Z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1153,7 +1157,7 @@ func (bbp SkipTestNew) MarshalBebop() []byte { return buf } -func MakeSkipTestNew(r iohelp.ErrorReader) (SkipTestNew, error) { +func MakeSkipTestNew(r *iohelp.ErrorReader) (SkipTestNew, error) { v := SkipTestNew{} err := v.DecodeBebop(r) return v, err @@ -1186,7 +1190,8 @@ func (bbp SkipTestOldContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.S).MarshalBebopTo(buf[at:]) - tmp486 := (*bbp.S); at += tmp486.Size() + tmp := (*bbp.S) + at += tmp.Size() } if bbp.After != nil { buf[at] = 2 @@ -1210,7 +1215,8 @@ func (bbp *SkipTestOldContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp494 := ((*bbp.S)); at += tmp494.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1235,7 +1241,8 @@ func (bbp *SkipTestOldContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.S = new(SkipTestOld) (*bbp.S) = MustMakeSkipTestOldFromBytes(buf[at:]) - tmp507 := ((*bbp.S)); at += tmp507.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1281,7 +1288,7 @@ func (bbp *SkipTestOldContainer) DecodeBebop(ior io.Reader) (err error) { bbp.After = new(int32) *bbp.After = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1291,7 +1298,8 @@ func (bbp SkipTestOldContainer) Size() int { bodyLen := 5 if bbp.S != nil { bodyLen += 1 - tmp523 := (*bbp.S); bodyLen += tmp523.Size() + tmp := (*bbp.S) + bodyLen += tmp.Size() } if bbp.After != nil { bodyLen += 1 @@ -1306,7 +1314,7 @@ func (bbp SkipTestOldContainer) MarshalBebop() []byte { return buf } -func MakeSkipTestOldContainer(r iohelp.ErrorReader) (SkipTestOldContainer, error) { +func MakeSkipTestOldContainer(r *iohelp.ErrorReader) (SkipTestOldContainer, error) { v := SkipTestOldContainer{} err := v.DecodeBebop(r) return v, err @@ -1339,7 +1347,8 @@ func (bbp SkipTestNewContainer) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.S).MarshalBebopTo(buf[at:]) - tmp540 := (*bbp.S); at += tmp540.Size() + tmp := (*bbp.S) + at += tmp.Size() } if bbp.After != nil { buf[at] = 2 @@ -1363,7 +1372,8 @@ func (bbp *SkipTestNewContainer) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp547 := ((*bbp.S)); at += tmp547.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1388,7 +1398,8 @@ func (bbp *SkipTestNewContainer) MustUnmarshalBebop(buf []byte) { at += 1 bbp.S = new(SkipTestNew) (*bbp.S) = MustMakeSkipTestNewFromBytes(buf[at:]) - tmp558 := ((*bbp.S)); at += tmp558.Size() + tmp := ((*bbp.S)) + at += tmp.Size() case 2: at += 1 bbp.After = new(int32) @@ -1434,7 +1445,7 @@ func (bbp *SkipTestNewContainer) DecodeBebop(ior io.Reader) (err error) { bbp.After = new(int32) *bbp.After = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -1444,7 +1455,8 @@ func (bbp SkipTestNewContainer) Size() int { bodyLen := 5 if bbp.S != nil { bodyLen += 1 - tmp591 := (*bbp.S); bodyLen += tmp591.Size() + tmp := (*bbp.S) + bodyLen += tmp.Size() } if bbp.After != nil { bodyLen += 1 @@ -1459,7 +1471,7 @@ func (bbp SkipTestNewContainer) MarshalBebop() []byte { return buf } -func MakeSkipTestNewContainer(r iohelp.ErrorReader) (SkipTestNewContainer, error) { +func MakeSkipTestNewContainer(r *iohelp.ErrorReader) (SkipTestNewContainer, error) { v := SkipTestNewContainer{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/map_types.go b/testdata/generated/map_types.go index eea2323..c9884c3 100644 --- a/testdata/generated/map_types.go +++ b/testdata/generated/map_types.go @@ -74,7 +74,7 @@ func (bbp S) MarshalBebop() []byte { return buf } -func MakeS(r iohelp.ErrorReader) (S, error) { +func MakeS(r *iohelp.ErrorReader) (S, error) { v := S{} err := v.DecodeBebop(r) return v, err @@ -164,7 +164,8 @@ func (bbp SomeMaps) MarshalBebopTo(buf []byte) int { iohelp.WriteBoolBytes(buf[at:], k4) at += 1 (v4).MarshalBebopTo(buf[at:]) - tmp1350 := (v4); at += tmp1350.Size() + tmp := (v4) + at += tmp.Size() } } } @@ -192,7 +193,8 @@ func (bbp SomeMaps) MarshalBebopTo(buf []byte) int { iohelp.WriteGUIDBytes(buf[at:], k1) at += 16 (v1).MarshalBebopTo(buf[at:]) - tmp1391 := (v1); at += tmp1391.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -273,7 +275,8 @@ func (bbp *SomeMaps) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1481 := (((((bbp.M3)[i1])[k2])[i3])[k4]); at += tmp1481.Size() + tmp := (((((bbp.M3)[i1])[k2])[i3])[k4]) + at += tmp.Size() } } } @@ -320,7 +323,8 @@ func (bbp *SomeMaps) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1544 := ((bbp.M5)[k1]); at += tmp1544.Size() + tmp := ((bbp.M5)[k1]) + at += tmp.Size() } return nil } @@ -371,7 +375,8 @@ func (bbp *SomeMaps) MustUnmarshalBebop(buf []byte) { k4 := iohelp.ReadBoolBytes(buf[at:]) at += 1 ((((bbp.M3)[i1])[k2])[i3])[k4] = MustMakeSFromBytes(buf[at:]) - tmp1597 := (((((bbp.M3)[i1])[k2])[i3])[k4]); at += tmp1597.Size() + tmp := (((((bbp.M3)[i1])[k2])[i3])[k4]) + at += tmp.Size() } } } @@ -400,7 +405,8 @@ func (bbp *SomeMaps) MustUnmarshalBebop(buf []byte) { k1 := iohelp.ReadGUIDBytes(buf[at:]) at += 16 (bbp.M5)[k1] = MustMakeMFromBytes(buf[at:]) - tmp1634 := ((bbp.M5)[k1]); at += tmp1634.Size() + tmp := ((bbp.M5)[k1]) + at += tmp.Size() } } @@ -553,7 +559,8 @@ func (bbp SomeMaps) Size() int { bodyLen += 4 for _, v4 := range elem { bodyLen += 1 - tmp1799 := (v4); bodyLen += tmp1799.Size() + tmp := (v4) + bodyLen += tmp.Size() } } } @@ -570,7 +577,8 @@ func (bbp SomeMaps) Size() int { bodyLen += 4 for _, v1 := range bbp.M5 { bodyLen += 16 - tmp1823 := (v1); bodyLen += tmp1823.Size() + tmp := (v1) + bodyLen += tmp.Size() } return bodyLen } @@ -581,7 +589,7 @@ func (bbp SomeMaps) MarshalBebop() []byte { return buf } -func MakeSomeMaps(r iohelp.ErrorReader) (SomeMaps, error) { +func MakeSomeMaps(r *iohelp.ErrorReader) (SomeMaps, error) { v := SomeMaps{} err := v.DecodeBebop(r) return v, err @@ -703,7 +711,7 @@ func (bbp *M) DecodeBebop(ior io.Reader) (err error) { bbp.B = new(float64) *bbp.B = iohelp.ReadFloat64(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -728,7 +736,7 @@ func (bbp M) MarshalBebop() []byte { return buf } -func MakeM(r iohelp.ErrorReader) (M, error) { +func MakeM(r *iohelp.ErrorReader) (M, error) { v := M{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/message_1.go b/testdata/generated/message_1.go index f1b51d0..8b1a28a 100644 --- a/testdata/generated/message_1.go +++ b/testdata/generated/message_1.go @@ -139,7 +139,7 @@ func (bbp *ExampleMessage) DecodeBebop(ior io.Reader) (err error) { bbp.Z = new(int32) *bbp.Z = iohelp.ReadInt32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -168,7 +168,7 @@ func (bbp ExampleMessage) MarshalBebop() []byte { return buf } -func MakeExampleMessage(r iohelp.ErrorReader) (ExampleMessage, error) { +func MakeExampleMessage(r *iohelp.ErrorReader) (ExampleMessage, error) { v := ExampleMessage{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/message_map.go b/testdata/generated/message_map.go index d2ae6e8..898f070 100644 --- a/testdata/generated/message_map.go +++ b/testdata/generated/message_map.go @@ -119,7 +119,7 @@ func (bbp *ReadOnlyMap) DecodeBebop(ior io.Reader) (err error) { (*bbp.Vals)[k3] = iohelp.ReadUint8(r) } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -144,7 +144,7 @@ func (bbp ReadOnlyMap) MarshalBebop() []byte { return buf } -func MakeReadOnlyMap(r iohelp.ErrorReader) (ReadOnlyMap, error) { +func MakeReadOnlyMap(r *iohelp.ErrorReader) (ReadOnlyMap, error) { v := ReadOnlyMap{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/msgpack_comparison.go b/testdata/generated/msgpack_comparison.go index 535842a..f359e7b 100644 --- a/testdata/generated/msgpack_comparison.go +++ b/testdata/generated/msgpack_comparison.go @@ -404,7 +404,7 @@ func (bbp MsgpackComparison) MarshalBebop() []byte { return buf } -func MakeMsgpackComparison(r iohelp.ErrorReader) (MsgpackComparison, error) { +func MakeMsgpackComparison(r *iohelp.ErrorReader) (MsgpackComparison, error) { v := MsgpackComparison{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/quoted_string.go b/testdata/generated/quoted_string.go index 6004095..3283423 100644 --- a/testdata/generated/quoted_string.go +++ b/testdata/generated/quoted_string.go @@ -90,7 +90,7 @@ func (bbp QuotedString) MarshalBebop() []byte { return buf } -func MakeQuotedString(r iohelp.ErrorReader) (QuotedString, error) { +func MakeQuotedString(r *iohelp.ErrorReader) (QuotedString, error) { v := QuotedString{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/request.go b/testdata/generated/request.go index 96da4f1..91294c3 100644 --- a/testdata/generated/request.go +++ b/testdata/generated/request.go @@ -94,7 +94,7 @@ func (bbp Furniture) MarshalBebop() []byte { return buf } -func MakeFurniture(r iohelp.ErrorReader) (Furniture, error) { +func MakeFurniture(r *iohelp.ErrorReader) (Furniture, error) { v := Furniture{} err := v.DecodeBebop(r) return v, err @@ -150,7 +150,8 @@ func (bbp RequestResponse) MarshalBebopTo(buf []byte) int { at += 4 for _, v1 := range bbp.availableFurniture { (v1).MarshalBebopTo(buf[at:]) - tmp883 := (v1); at += tmp883.Size() + tmp := (v1) + at += tmp.Size() } return at } @@ -167,7 +168,8 @@ func (bbp *RequestResponse) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp914 := ((bbp.availableFurniture)[i1]); at += tmp914.Size() + tmp := ((bbp.availableFurniture)[i1]) + at += tmp.Size() } return nil } @@ -178,7 +180,8 @@ func (bbp *RequestResponse) MustUnmarshalBebop(buf []byte) { at += 4 for i1 := range bbp.availableFurniture { (bbp.availableFurniture)[i1] = MustMakeFurnitureFromBytes(buf[at:]) - tmp936 := ((bbp.availableFurniture)[i1]); at += tmp936.Size() + tmp := ((bbp.availableFurniture)[i1]) + at += tmp.Size() } } @@ -210,7 +213,8 @@ func (bbp RequestResponse) Size() int { bodyLen := 0 bodyLen += 4 for _, elem := range bbp.availableFurniture { - tmp979 := (elem); bodyLen += tmp979.Size() + tmp := (elem) + bodyLen += tmp.Size() } return bodyLen } @@ -221,7 +225,7 @@ func (bbp RequestResponse) MarshalBebop() []byte { return buf } -func MakeRequestResponse(r iohelp.ErrorReader) (RequestResponse, error) { +func MakeRequestResponse(r *iohelp.ErrorReader) (RequestResponse, error) { v := RequestResponse{} err := v.DecodeBebop(r) return v, err @@ -345,7 +349,7 @@ func (bbp *RequestCatalog) DecodeBebop(ior io.Reader) (err error) { bbp.SecretTunnel = new(string) *bbp.SecretTunnel = iohelp.ReadString(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -366,7 +370,7 @@ func (bbp RequestCatalog) MarshalBebop() []byte { return buf } -func MakeRequestCatalog(r iohelp.ErrorReader) (RequestCatalog, error) { +func MakeRequestCatalog(r *iohelp.ErrorReader) (RequestCatalog, error) { v := RequestCatalog{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/server.go b/testdata/generated/server.go index e07f6ce..0757b59 100644 --- a/testdata/generated/server.go +++ b/testdata/generated/server.go @@ -63,7 +63,7 @@ func (bbp Print) MarshalBebop() []byte { return buf } -func MakePrint(r iohelp.ErrorReader) (Print, error) { +func MakePrint(r *iohelp.ErrorReader) (Print, error) { v := Print{} err := v.DecodeBebop(r) return v, err @@ -147,7 +147,7 @@ func (bbp Add) MarshalBebop() []byte { return buf } -func MakeAdd(r iohelp.ErrorReader) (Add, error) { +func MakeAdd(r *iohelp.ErrorReader) (Add, error) { v := Add{} err := v.DecodeBebop(r) return v, err @@ -218,7 +218,7 @@ func (bbp AddResponse) MarshalBebop() []byte { return buf } -func MakeAddResponse(r iohelp.ErrorReader) (AddResponse, error) { +func MakeAddResponse(r *iohelp.ErrorReader) (AddResponse, error) { v := AddResponse{} err := v.DecodeBebop(r) return v, err @@ -252,7 +252,8 @@ func (bbp PrintRequest) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Print).MarshalBebopTo(buf[at:]) - tmp973 := (*bbp.Print); at += tmp973.Size() + tmp := (*bbp.Print) + at += tmp.Size() } return at } @@ -270,7 +271,8 @@ func (bbp *PrintRequest) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp984 := ((*bbp.Print)); at += tmp984.Size() + tmp := ((*bbp.Print)) + at += tmp.Size() default: return nil } @@ -287,7 +289,8 @@ func (bbp *PrintRequest) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Print = new(Print) (*bbp.Print) = MustMakePrintFromBytes(buf[at:]) - tmp997 := ((*bbp.Print)); at += tmp997.Size() + tmp := ((*bbp.Print)) + at += tmp.Size() default: return } @@ -321,7 +324,7 @@ func (bbp *PrintRequest) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -331,7 +334,8 @@ func (bbp PrintRequest) Size() int { bodyLen := 5 if bbp.Print != nil { bodyLen += 1 - tmp1107 := (*bbp.Print); bodyLen += tmp1107.Size() + tmp := (*bbp.Print) + bodyLen += tmp.Size() } return bodyLen } @@ -342,7 +346,7 @@ func (bbp PrintRequest) MarshalBebop() []byte { return buf } -func MakePrintRequest(r iohelp.ErrorReader) (PrintRequest, error) { +func MakePrintRequest(r *iohelp.ErrorReader) (PrintRequest, error) { v := PrintRequest{} err := v.DecodeBebop(r) return v, err @@ -376,7 +380,8 @@ func (bbp AddRequest) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Add).MarshalBebopTo(buf[at:]) - tmp1168 := (*bbp.Add); at += tmp1168.Size() + tmp := (*bbp.Add) + at += tmp.Size() } return at } @@ -394,7 +399,8 @@ func (bbp *AddRequest) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1172 := ((*bbp.Add)); at += tmp1172.Size() + tmp := ((*bbp.Add)) + at += tmp.Size() default: return nil } @@ -411,7 +417,8 @@ func (bbp *AddRequest) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Add = new(Add) (*bbp.Add) = MustMakeAddFromBytes(buf[at:]) - tmp1185 := ((*bbp.Add)); at += tmp1185.Size() + tmp := ((*bbp.Add)) + at += tmp.Size() default: return } @@ -445,7 +452,7 @@ func (bbp *AddRequest) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -455,7 +462,8 @@ func (bbp AddRequest) Size() int { bodyLen := 5 if bbp.Add != nil { bodyLen += 1 - tmp1226 := (*bbp.Add); bodyLen += tmp1226.Size() + tmp := (*bbp.Add) + bodyLen += tmp.Size() } return bodyLen } @@ -466,7 +474,7 @@ func (bbp AddRequest) MarshalBebop() []byte { return buf } -func MakeAddRequest(r iohelp.ErrorReader) (AddRequest, error) { +func MakeAddRequest(r *iohelp.ErrorReader) (AddRequest, error) { v := AddRequest{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/tags.go b/testdata/generated/tags.go index 4c4529d..9bee6f9 100644 --- a/testdata/generated/tags.go +++ b/testdata/generated/tags.go @@ -63,7 +63,7 @@ func (bbp TaggedStruct) MarshalBebop() []byte { return buf } -func MakeTaggedStruct(r iohelp.ErrorReader) (TaggedStruct, error) { +func MakeTaggedStruct(r *iohelp.ErrorReader) (TaggedStruct, error) { v := TaggedStruct{} err := v.DecodeBebop(r) return v, err @@ -158,7 +158,7 @@ func (bbp *TaggedMessage) DecodeBebop(ior io.Reader) (err error) { bbp.Bar = new(uint8) *bbp.Bar = iohelp.ReadUint8(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -179,7 +179,7 @@ func (bbp TaggedMessage) MarshalBebop() []byte { return buf } -func MakeTaggedMessage(r iohelp.ErrorReader) (TaggedMessage, error) { +func MakeTaggedMessage(r *iohelp.ErrorReader) (TaggedMessage, error) { v := TaggedMessage{} err := v.DecodeBebop(r) return v, err @@ -250,7 +250,7 @@ func (bbp TaggedSubStruct) MarshalBebop() []byte { return buf } -func MakeTaggedSubStruct(r iohelp.ErrorReader) (TaggedSubStruct, error) { +func MakeTaggedSubStruct(r *iohelp.ErrorReader) (TaggedSubStruct, error) { v := TaggedSubStruct{} err := v.DecodeBebop(r) return v, err @@ -282,7 +282,8 @@ func (bbp TaggedUnion) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.TaggedSubStruct).MarshalBebopTo(buf[at:]) - tmp555 := (*bbp.TaggedSubStruct); at += tmp555.Size() + tmp := (*bbp.TaggedSubStruct) + at += tmp.Size() return at } return at @@ -304,7 +305,8 @@ func (bbp *TaggedUnion) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp568 := ((*bbp.TaggedSubStruct)); at += tmp568.Size() + tmp := ((*bbp.TaggedSubStruct)) + at += tmp.Size() return nil default: return nil @@ -322,7 +324,8 @@ func (bbp *TaggedUnion) MustUnmarshalBebop(buf []byte) { at += 1 bbp.TaggedSubStruct = new(TaggedSubStruct) (*bbp.TaggedSubStruct) = MustMakeTaggedSubStructFromBytes(buf[at:]) - tmp598 := ((*bbp.TaggedSubStruct)); at += tmp598.Size() + tmp := ((*bbp.TaggedSubStruct)) + at += tmp.Size() return default: return @@ -356,10 +359,10 @@ func (bbp *TaggedUnion) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -369,7 +372,8 @@ func (bbp TaggedUnion) Size() int { bodyLen := 4 if bbp.TaggedSubStruct != nil { bodyLen += 1 - tmp618 := (*bbp.TaggedSubStruct); bodyLen += tmp618.Size() + tmp := (*bbp.TaggedSubStruct) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -381,7 +385,7 @@ func (bbp TaggedUnion) MarshalBebop() []byte { return buf } -func MakeTaggedUnion(r iohelp.ErrorReader) (TaggedUnion, error) { +func MakeTaggedUnion(r *iohelp.ErrorReader) (TaggedUnion, error) { v := TaggedUnion{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/typed_enums.go b/testdata/generated/typed_enums.go index f6150dc..c1ce2c5 100644 --- a/testdata/generated/typed_enums.go +++ b/testdata/generated/typed_enums.go @@ -174,7 +174,7 @@ func (bbp UsesAllEnums) MarshalBebop() []byte { return buf } -func MakeUsesAllEnums(r iohelp.ErrorReader) (UsesAllEnums, error) { +func MakeUsesAllEnums(r *iohelp.ErrorReader) (UsesAllEnums, error) { v := UsesAllEnums{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/union.go b/testdata/generated/union.go index 6c13163..3160b3b 100644 --- a/testdata/generated/union.go +++ b/testdata/generated/union.go @@ -85,7 +85,7 @@ func (bbp *A) DecodeBebop(ior io.Reader) (err error) { bbp.B = new(uint32) *bbp.B = iohelp.ReadUint32(r) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -106,7 +106,7 @@ func (bbp A) MarshalBebop() []byte { return buf } -func MakeA(r iohelp.ErrorReader) (A, error) { +func MakeA(r *iohelp.ErrorReader) (A, error) { v := A{} err := v.DecodeBebop(r) return v, err @@ -180,7 +180,7 @@ func (bbp B) MarshalBebop() []byte { return buf } -func MakeB(r iohelp.ErrorReader) (B, error) { +func MakeB(r *iohelp.ErrorReader) (B, error) { v := B{} err := v.DecodeBebop(r) return v, err @@ -230,7 +230,7 @@ func (bbp C) MarshalBebop() []byte { return []byte{} } -func MakeC(r iohelp.ErrorReader) (C, error) { +func MakeC(r *iohelp.ErrorReader) (C, error) { return C{}, nil } @@ -263,21 +263,24 @@ func (bbp U) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.A).MarshalBebopTo(buf[at:]) - tmp874 := (*bbp.A); at += tmp874.Size() + tmp := (*bbp.A) + at += tmp.Size() return at } if bbp.B != nil { buf[at] = 2 at++ (*bbp.B).MarshalBebopTo(buf[at:]) - tmp893 := (*bbp.B); at += tmp893.Size() + tmp := (*bbp.B) + at += tmp.Size() return at } if bbp.C != nil { buf[at] = 3 at++ (*bbp.C).MarshalBebopTo(buf[at:]) - tmp912 := (*bbp.C); at += tmp912.Size() + tmp := (*bbp.C) + at += tmp.Size() return at } return at @@ -299,7 +302,8 @@ func (bbp *U) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp946 := ((*bbp.A)); at += tmp946.Size() + tmp := ((*bbp.A)) + at += tmp.Size() return nil case 2: at += 1 @@ -308,7 +312,8 @@ func (bbp *U) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp955 := ((*bbp.B)); at += tmp955.Size() + tmp := ((*bbp.B)) + at += tmp.Size() return nil case 3: at += 1 @@ -317,7 +322,8 @@ func (bbp *U) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp963 := ((*bbp.C)); at += tmp963.Size() + tmp := ((*bbp.C)) + at += tmp.Size() return nil default: return nil @@ -335,19 +341,22 @@ func (bbp *U) MustUnmarshalBebop(buf []byte) { at += 1 bbp.A = new(A) (*bbp.A) = MustMakeAFromBytes(buf[at:]) - tmp975 := ((*bbp.A)); at += tmp975.Size() + tmp := ((*bbp.A)) + at += tmp.Size() return case 2: at += 1 bbp.B = new(B) (*bbp.B) = MustMakeBFromBytes(buf[at:]) - tmp980 := ((*bbp.B)); at += tmp980.Size() + tmp := ((*bbp.B)) + at += tmp.Size() return case 3: at += 1 bbp.C = new(C) (*bbp.C) = MustMakeCFromBytes(buf[at:]) - tmp982 := ((*bbp.C)); at += tmp982.Size() + tmp := ((*bbp.C)) + at += tmp.Size() return default: return @@ -397,7 +406,7 @@ func (bbp *U) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.B = new(B) @@ -405,7 +414,7 @@ func (bbp *U) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 3: bbp.C = new(C) @@ -413,10 +422,10 @@ func (bbp *U) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -426,17 +435,20 @@ func (bbp U) Size() int { bodyLen := 4 if bbp.A != nil { bodyLen += 1 - tmp1033 := (*bbp.A); bodyLen += tmp1033.Size() + tmp := (*bbp.A) + bodyLen += tmp.Size() return bodyLen } if bbp.B != nil { bodyLen += 1 - tmp1039 := (*bbp.B); bodyLen += tmp1039.Size() + tmp := (*bbp.B) + bodyLen += tmp.Size() return bodyLen } if bbp.C != nil { bodyLen += 1 - tmp1050 := (*bbp.C); bodyLen += tmp1050.Size() + tmp := (*bbp.C) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -448,7 +460,7 @@ func (bbp U) MarshalBebop() []byte { return buf } -func MakeU(r iohelp.ErrorReader) (U, error) { +func MakeU(r *iohelp.ErrorReader) (U, error) { v := U{} err := v.DecodeBebop(r) return v, err @@ -478,7 +490,8 @@ func (bbp Cons) MarshalBebopTo(buf []byte) int { iohelp.WriteUint32Bytes(buf[at:], bbp.Head) at += 4 (bbp.Tail).MarshalBebopTo(buf[at:]) - tmp1104 := (bbp.Tail); at += tmp1104.Size() + tmp := (bbp.Tail) + at += tmp.Size() return at } @@ -493,7 +506,8 @@ func (bbp *Cons) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1125 := (bbp.Tail); at += tmp1125.Size() + tmp := (bbp.Tail) + at += tmp.Size() return nil } @@ -502,7 +516,8 @@ func (bbp *Cons) MustUnmarshalBebop(buf []byte) { bbp.Head = iohelp.ReadUint32Bytes(buf[at:]) at += 4 bbp.Tail = MustMakeListFromBytes(buf[at:]) - tmp1135 := (bbp.Tail); at += tmp1135.Size() + tmp := (bbp.Tail) + at += tmp.Size() } func (bbp Cons) EncodeBebop(iow io.Writer) (err error) { @@ -528,7 +543,8 @@ func (bbp *Cons) DecodeBebop(ior io.Reader) (err error) { func (bbp Cons) Size() int { bodyLen := 0 bodyLen += 4 - tmp1160 := (bbp.Tail); bodyLen += tmp1160.Size() + tmp := (bbp.Tail) + bodyLen += tmp.Size() return bodyLen } @@ -538,7 +554,7 @@ func (bbp Cons) MarshalBebop() []byte { return buf } -func MakeCons(r iohelp.ErrorReader) (Cons, error) { +func MakeCons(r *iohelp.ErrorReader) (Cons, error) { v := Cons{} err := v.DecodeBebop(r) return v, err @@ -589,7 +605,7 @@ func (bbp Null) MarshalBebop() []byte { return []byte{} } -func MakeNull(r iohelp.ErrorReader) (Null, error) { +func MakeNull(r *iohelp.ErrorReader) (Null, error) { return Null{}, nil } @@ -616,14 +632,16 @@ func (bbp List) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Cons).MarshalBebopTo(buf[at:]) - tmp1220 := (*bbp.Cons); at += tmp1220.Size() + tmp := (*bbp.Cons) + at += tmp.Size() return at } if bbp.Null != nil { buf[at] = 2 at++ (*bbp.Null).MarshalBebopTo(buf[at:]) - tmp1230 := (*bbp.Null); at += tmp1230.Size() + tmp := (*bbp.Null) + at += tmp.Size() return at } return at @@ -645,7 +663,8 @@ func (bbp *List) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1233 := ((*bbp.Cons)); at += tmp1233.Size() + tmp := ((*bbp.Cons)) + at += tmp.Size() return nil case 2: at += 1 @@ -654,7 +673,8 @@ func (bbp *List) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp1234 := ((*bbp.Null)); at += tmp1234.Size() + tmp := ((*bbp.Null)) + at += tmp.Size() return nil default: return nil @@ -672,13 +692,15 @@ func (bbp *List) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Cons = new(Cons) (*bbp.Cons) = MustMakeConsFromBytes(buf[at:]) - tmp1235 := ((*bbp.Cons)); at += tmp1235.Size() + tmp := ((*bbp.Cons)) + at += tmp.Size() return case 2: at += 1 bbp.Null = new(Null) (*bbp.Null) = MustMakeNullFromBytes(buf[at:]) - tmp1236 := ((*bbp.Null)); at += tmp1236.Size() + tmp := ((*bbp.Null)) + at += tmp.Size() return default: return @@ -720,7 +742,7 @@ func (bbp *List) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.Null = new(Null) @@ -728,10 +750,10 @@ func (bbp *List) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -741,12 +763,14 @@ func (bbp List) Size() int { bodyLen := 4 if bbp.Cons != nil { bodyLen += 1 - tmp1251 := (*bbp.Cons); bodyLen += tmp1251.Size() + tmp := (*bbp.Cons) + bodyLen += tmp.Size() return bodyLen } if bbp.Null != nil { bodyLen += 1 - tmp1256 := (*bbp.Null); bodyLen += tmp1256.Size() + tmp := (*bbp.Null) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -758,7 +782,7 @@ func (bbp List) MarshalBebop() []byte { return buf } -func MakeList(r iohelp.ErrorReader) (List, error) { +func MakeList(r *iohelp.ErrorReader) (List, error) { v := List{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/generated/union_field.go b/testdata/generated/union_field.go index 14b2c74..7235808 100644 --- a/testdata/generated/union_field.go +++ b/testdata/generated/union_field.go @@ -22,7 +22,8 @@ func (bbp WithUnionField) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Test).MarshalBebopTo(buf[at:]) - tmp683 := (*bbp.Test); at += tmp683.Size() + tmp := (*bbp.Test) + at += tmp.Size() } return at } @@ -40,7 +41,8 @@ func (bbp *WithUnionField) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp686 := ((*bbp.Test)); at += tmp686.Size() + tmp := ((*bbp.Test)) + at += tmp.Size() default: return nil } @@ -57,7 +59,8 @@ func (bbp *WithUnionField) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Test = new(List2) (*bbp.Test) = MustMakeList2FromBytes(buf[at:]) - tmp691 := ((*bbp.Test)); at += tmp691.Size() + tmp := ((*bbp.Test)) + at += tmp.Size() default: return } @@ -91,7 +94,7 @@ func (bbp *WithUnionField) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -101,7 +104,8 @@ func (bbp WithUnionField) Size() int { bodyLen := 5 if bbp.Test != nil { bodyLen += 1 - tmp718 := (*bbp.Test); bodyLen += tmp718.Size() + tmp := (*bbp.Test) + bodyLen += tmp.Size() } return bodyLen } @@ -112,7 +116,7 @@ func (bbp WithUnionField) MarshalBebop() []byte { return buf } -func MakeWithUnionField(r iohelp.ErrorReader) (WithUnionField, error) { +func MakeWithUnionField(r *iohelp.ErrorReader) (WithUnionField, error) { v := WithUnionField{} err := v.DecodeBebop(r) return v, err @@ -190,7 +194,7 @@ func (bbp Cons2) MarshalBebop() []byte { return buf } -func MakeCons2(r iohelp.ErrorReader) (Cons2, error) { +func MakeCons2(r *iohelp.ErrorReader) (Cons2, error) { v := Cons2{} err := v.DecodeBebop(r) return v, err @@ -241,7 +245,7 @@ func (bbp Nil2) MarshalBebop() []byte { return []byte{} } -func MakeNil2(r iohelp.ErrorReader) (Nil2, error) { +func MakeNil2(r *iohelp.ErrorReader) (Nil2, error) { return Nil2{}, nil } @@ -268,14 +272,16 @@ func (bbp List2) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Cons2).MarshalBebopTo(buf[at:]) - tmp938 := (*bbp.Cons2); at += tmp938.Size() + tmp := (*bbp.Cons2) + at += tmp.Size() return at } if bbp.Nil2 != nil { buf[at] = 2 at++ (*bbp.Nil2).MarshalBebopTo(buf[at:]) - tmp957 := (*bbp.Nil2); at += tmp957.Size() + tmp := (*bbp.Nil2) + at += tmp.Size() return at } return at @@ -297,7 +303,8 @@ func (bbp *List2) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp978 := ((*bbp.Cons2)); at += tmp978.Size() + tmp := ((*bbp.Cons2)) + at += tmp.Size() return nil case 2: at += 1 @@ -306,7 +313,8 @@ func (bbp *List2) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp983 := ((*bbp.Nil2)); at += tmp983.Size() + tmp := ((*bbp.Nil2)) + at += tmp.Size() return nil default: return nil @@ -324,13 +332,15 @@ func (bbp *List2) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Cons2 = new(Cons2) (*bbp.Cons2) = MustMakeCons2FromBytes(buf[at:]) - tmp1001 := ((*bbp.Cons2)); at += tmp1001.Size() + tmp := ((*bbp.Cons2)) + at += tmp.Size() return case 2: at += 1 bbp.Nil2 = new(Nil2) (*bbp.Nil2) = MustMakeNil2FromBytes(buf[at:]) - tmp1009 := ((*bbp.Nil2)); at += tmp1009.Size() + tmp := ((*bbp.Nil2)) + at += tmp.Size() return default: return @@ -372,7 +382,7 @@ func (bbp *List2) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.Nil2 = new(Nil2) @@ -380,10 +390,10 @@ func (bbp *List2) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -393,12 +403,14 @@ func (bbp List2) Size() int { bodyLen := 4 if bbp.Cons2 != nil { bodyLen += 1 - tmp1082 := (*bbp.Cons2); bodyLen += tmp1082.Size() + tmp := (*bbp.Cons2) + bodyLen += tmp.Size() return bodyLen } if bbp.Nil2 != nil { bodyLen += 1 - tmp1095 := (*bbp.Nil2); bodyLen += tmp1095.Size() + tmp := (*bbp.Nil2) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -410,7 +422,7 @@ func (bbp List2) MarshalBebop() []byte { return buf } -func MakeList2(r iohelp.ErrorReader) (List2, error) { +func MakeList2(r *iohelp.ErrorReader) (List2, error) { v := List2{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/incompatible/generated/import_separate_a.go b/testdata/incompatible/generated/import_separate_a.go index d675680..9c4865c 100644 --- a/testdata/incompatible/generated/import_separate_a.go +++ b/testdata/incompatible/generated/import_separate_a.go @@ -22,7 +22,8 @@ type UsesImport struct { func (bbp UsesImport) MarshalBebopTo(buf []byte) int { at := 0 (bbp.Imported).MarshalBebopTo(buf[at:]) - tmp5220 := (bbp.Imported); at += tmp5220.Size() + tmp := (bbp.Imported) + at += tmp.Size() return at } @@ -32,14 +33,16 @@ func (bbp *UsesImport) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5221 := (bbp.Imported); at += tmp5221.Size() + tmp := (bbp.Imported) + at += tmp.Size() return nil } func (bbp *UsesImport) MustUnmarshalBebop(buf []byte) { at := 0 bbp.Imported = generatedtwo.MustMakeImportedTypeFromBytes(buf[at:]) - tmp5222 := (bbp.Imported); at += tmp5222.Size() + tmp := (bbp.Imported) + at += tmp.Size() } func (bbp UsesImport) EncodeBebop(iow io.Writer) (err error) { @@ -62,7 +65,8 @@ func (bbp *UsesImport) DecodeBebop(ior io.Reader) (err error) { func (bbp UsesImport) Size() int { bodyLen := 0 - tmp5225 := (bbp.Imported); bodyLen += tmp5225.Size() + tmp := (bbp.Imported) + bodyLen += tmp.Size() return bodyLen } @@ -72,7 +76,7 @@ func (bbp UsesImport) MarshalBebop() []byte { return buf } -func MakeUsesImport(r iohelp.ErrorReader) (UsesImport, error) { +func MakeUsesImport(r *iohelp.ErrorReader) (UsesImport, error) { v := UsesImport{} err := v.DecodeBebop(r) return v, err @@ -104,7 +108,8 @@ func (bbp UsesImportMsg) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.Imported).MarshalBebopTo(buf[at:]) - tmp5234 := (*bbp.Imported); at += tmp5234.Size() + tmp := (*bbp.Imported) + at += tmp.Size() } return at } @@ -122,7 +127,8 @@ func (bbp *UsesImportMsg) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5237 := ((*bbp.Imported)); at += tmp5237.Size() + tmp := ((*bbp.Imported)) + at += tmp.Size() default: return nil } @@ -139,7 +145,8 @@ func (bbp *UsesImportMsg) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Imported = new(generatedtwo.ImportedType) (*bbp.Imported) = generatedtwo.MustMakeImportedTypeFromBytes(buf[at:]) - tmp5238 := ((*bbp.Imported)); at += tmp5238.Size() + tmp := ((*bbp.Imported)) + at += tmp.Size() default: return } @@ -173,7 +180,7 @@ func (bbp *UsesImportMsg) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -183,7 +190,8 @@ func (bbp UsesImportMsg) Size() int { bodyLen := 5 if bbp.Imported != nil { bodyLen += 1 - tmp5246 := (*bbp.Imported); bodyLen += tmp5246.Size() + tmp := (*bbp.Imported) + bodyLen += tmp.Size() } return bodyLen } @@ -194,7 +202,7 @@ func (bbp UsesImportMsg) MarshalBebop() []byte { return buf } -func MakeUsesImportMsg(r iohelp.ErrorReader) (UsesImportMsg, error) { +func MakeUsesImportMsg(r *iohelp.ErrorReader) (UsesImportMsg, error) { v := UsesImportMsg{} err := v.DecodeBebop(r) return v, err @@ -262,7 +270,7 @@ func (bbp UnionStruct) MarshalBebop() []byte { return buf } -func MakeUnionStruct(r iohelp.ErrorReader) (UnionStruct, error) { +func MakeUnionStruct(r *iohelp.ErrorReader) (UnionStruct, error) { v := UnionStruct{} err := v.DecodeBebop(r) return v, err @@ -354,7 +362,7 @@ func (bbp *UnionMessage) DecodeBebop(ior io.Reader) (err error) { bbp.Goodbye = new(generatedtwo.ImportedEnum) *bbp.Goodbye = generatedtwo.ImportedEnum(iohelp.ReadUint32(r)) default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -375,7 +383,7 @@ func (bbp UnionMessage) MarshalBebop() []byte { return buf } -func MakeUnionMessage(r iohelp.ErrorReader) (UnionMessage, error) { +func MakeUnionMessage(r *iohelp.ErrorReader) (UnionMessage, error) { v := UnionMessage{} err := v.DecodeBebop(r) return v, err @@ -408,14 +416,16 @@ func (bbp UsesImportUnion) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.UnionStruct).MarshalBebopTo(buf[at:]) - tmp5344 := (*bbp.UnionStruct); at += tmp5344.Size() + tmp := (*bbp.UnionStruct) + at += tmp.Size() return at } if bbp.UnionMessage != nil { buf[at] = 2 at++ (*bbp.UnionMessage).MarshalBebopTo(buf[at:]) - tmp5359 := (*bbp.UnionMessage); at += tmp5359.Size() + tmp := (*bbp.UnionMessage) + at += tmp.Size() return at } return at @@ -437,7 +447,8 @@ func (bbp *UsesImportUnion) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5368 := ((*bbp.UnionStruct)); at += tmp5368.Size() + tmp := ((*bbp.UnionStruct)) + at += tmp.Size() return nil case 2: at += 1 @@ -446,7 +457,8 @@ func (bbp *UsesImportUnion) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5371 := ((*bbp.UnionMessage)); at += tmp5371.Size() + tmp := ((*bbp.UnionMessage)) + at += tmp.Size() return nil default: return nil @@ -464,13 +476,15 @@ func (bbp *UsesImportUnion) MustUnmarshalBebop(buf []byte) { at += 1 bbp.UnionStruct = new(UnionStruct) (*bbp.UnionStruct) = MustMakeUnionStructFromBytes(buf[at:]) - tmp5375 := ((*bbp.UnionStruct)); at += tmp5375.Size() + tmp := ((*bbp.UnionStruct)) + at += tmp.Size() return case 2: at += 1 bbp.UnionMessage = new(UnionMessage) (*bbp.UnionMessage) = MustMakeUnionMessageFromBytes(buf[at:]) - tmp5376 := ((*bbp.UnionMessage)); at += tmp5376.Size() + tmp := ((*bbp.UnionMessage)) + at += tmp.Size() return default: return @@ -512,7 +526,7 @@ func (bbp *UsesImportUnion) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.UnionMessage = new(UnionMessage) @@ -520,10 +534,10 @@ func (bbp *UsesImportUnion) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -533,12 +547,14 @@ func (bbp UsesImportUnion) Size() int { bodyLen := 4 if bbp.UnionStruct != nil { bodyLen += 1 - tmp5418 := (*bbp.UnionStruct); bodyLen += tmp5418.Size() + tmp := (*bbp.UnionStruct) + bodyLen += tmp.Size() return bodyLen } if bbp.UnionMessage != nil { bodyLen += 1 - tmp5428 := (*bbp.UnionMessage); bodyLen += tmp5428.Size() + tmp := (*bbp.UnionMessage) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -550,7 +566,7 @@ func (bbp UsesImportUnion) MarshalBebop() []byte { return buf } -func MakeUsesImportUnion(r iohelp.ErrorReader) (UsesImportUnion, error) { +func MakeUsesImportUnion(r *iohelp.ErrorReader) (UsesImportUnion, error) { v := UsesImportUnion{} err := v.DecodeBebop(r) return v, err diff --git a/testdata/incompatible/generatedthree/import_separate_c.go b/testdata/incompatible/generatedthree/import_separate_c.go index 58c6bbb..bb449da 100644 --- a/testdata/incompatible/generatedthree/import_separate_c.go +++ b/testdata/incompatible/generatedthree/import_separate_c.go @@ -44,7 +44,7 @@ func (bbp NotImported) MarshalBebop() []byte { return []byte{} } -func MakeNotImported(r iohelp.ErrorReader) (NotImported, error) { +func MakeNotImported(r *iohelp.ErrorReader) (NotImported, error) { return NotImported{}, nil } diff --git a/testdata/incompatible/generatedtwo/import_separate_b.go b/testdata/incompatible/generatedtwo/import_separate_b.go index 4a023c7..58d9f7a 100644 --- a/testdata/incompatible/generatedtwo/import_separate_b.go +++ b/testdata/incompatible/generatedtwo/import_separate_b.go @@ -73,7 +73,7 @@ func (bbp ImportedType) MarshalBebop() []byte { return buf } -func MakeImportedType(r iohelp.ErrorReader) (ImportedType, error) { +func MakeImportedType(r *iohelp.ErrorReader) (ImportedType, error) { v := ImportedType{} err := v.DecodeBebop(r) return v, err @@ -113,13 +113,15 @@ func (bbp ImportedMessage) MarshalBebopTo(buf []byte) int { buf[at] = 2 at++ (*bbp.Bar).MarshalBebopTo(buf[at:]) - tmp5512 := (*bbp.Bar); at += tmp5512.Size() + tmp := (*bbp.Bar) + at += tmp.Size() } if bbp.Unin != nil { buf[at] = 3 at++ (*bbp.Unin).MarshalBebopTo(buf[at:]) - tmp5520 := (*bbp.Unin); at += tmp5520.Size() + tmp := (*bbp.Unin) + at += tmp.Size() } return at } @@ -142,7 +144,8 @@ func (bbp *ImportedMessage) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5607 := ((*bbp.Bar)); at += tmp5607.Size() + tmp := ((*bbp.Bar)) + at += tmp.Size() case 3: at += 1 bbp.Unin = new(ImportedUnion) @@ -150,7 +153,8 @@ func (bbp *ImportedMessage) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5609 := ((*bbp.Unin)); at += tmp5609.Size() + tmp := ((*bbp.Unin)) + at += tmp.Size() default: return nil } @@ -172,12 +176,14 @@ func (bbp *ImportedMessage) MustUnmarshalBebop(buf []byte) { at += 1 bbp.Bar = new(ImportedType) (*bbp.Bar) = MustMakeImportedTypeFromBytes(buf[at:]) - tmp5635 := ((*bbp.Bar)); at += tmp5635.Size() + tmp := ((*bbp.Bar)) + at += tmp.Size() case 3: at += 1 bbp.Unin = new(ImportedUnion) (*bbp.Unin) = MustMakeImportedUnionFromBytes(buf[at:]) - tmp5636 := ((*bbp.Unin)); at += tmp5636.Size() + tmp := ((*bbp.Unin)) + at += tmp.Size() default: return } @@ -231,7 +237,7 @@ func (bbp *ImportedMessage) DecodeBebop(ior io.Reader) (err error) { return err } default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -245,11 +251,13 @@ func (bbp ImportedMessage) Size() int { } if bbp.Bar != nil { bodyLen += 1 - tmp5690 := (*bbp.Bar); bodyLen += tmp5690.Size() + tmp := (*bbp.Bar) + bodyLen += tmp.Size() } if bbp.Unin != nil { bodyLen += 1 - tmp5694 := (*bbp.Unin); bodyLen += tmp5694.Size() + tmp := (*bbp.Unin) + bodyLen += tmp.Size() } return bodyLen } @@ -260,7 +268,7 @@ func (bbp ImportedMessage) MarshalBebop() []byte { return buf } -func MakeImportedMessage(r iohelp.ErrorReader) (ImportedMessage, error) { +func MakeImportedMessage(r *iohelp.ErrorReader) (ImportedMessage, error) { v := ImportedMessage{} err := v.DecodeBebop(r) return v, err @@ -328,7 +336,7 @@ func (bbp *WhyAreTheseInline) DecodeBebop(ior io.Reader) (err error) { for { switch iohelp.ReadByte(r) { default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -343,7 +351,7 @@ func (bbp WhyAreTheseInline) MarshalBebop() []byte { return []byte{} } -func MakeWhyAreTheseInline(r iohelp.ErrorReader) (WhyAreTheseInline, error) { +func MakeWhyAreTheseInline(r *iohelp.ErrorReader) (WhyAreTheseInline, error) { return WhyAreTheseInline{}, nil } @@ -387,7 +395,7 @@ func (bbp Really) MarshalBebop() []byte { return []byte{} } -func MakeReally(r iohelp.ErrorReader) (Really, error) { +func MakeReally(r *iohelp.ErrorReader) (Really, error) { return Really{}, nil } @@ -414,14 +422,16 @@ func (bbp ImportedUnion) MarshalBebopTo(buf []byte) int { buf[at] = 1 at++ (*bbp.WhyAreTheseInline).MarshalBebopTo(buf[at:]) - tmp5721 := (*bbp.WhyAreTheseInline); at += tmp5721.Size() + tmp := (*bbp.WhyAreTheseInline) + at += tmp.Size() return at } if bbp.Really != nil { buf[at] = 2 at++ (*bbp.Really).MarshalBebopTo(buf[at:]) - tmp5727 := (*bbp.Really); at += tmp5727.Size() + tmp := (*bbp.Really) + at += tmp.Size() return at } return at @@ -443,7 +453,8 @@ func (bbp *ImportedUnion) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5730 := ((*bbp.WhyAreTheseInline)); at += tmp5730.Size() + tmp := ((*bbp.WhyAreTheseInline)) + at += tmp.Size() return nil case 2: at += 1 @@ -452,7 +463,8 @@ func (bbp *ImportedUnion) UnmarshalBebop(buf []byte) (err error) { if err != nil { return err } - tmp5735 := ((*bbp.Really)); at += tmp5735.Size() + tmp := ((*bbp.Really)) + at += tmp.Size() return nil default: return nil @@ -470,13 +482,15 @@ func (bbp *ImportedUnion) MustUnmarshalBebop(buf []byte) { at += 1 bbp.WhyAreTheseInline = new(WhyAreTheseInline) (*bbp.WhyAreTheseInline) = MustMakeWhyAreTheseInlineFromBytes(buf[at:]) - tmp5745 := ((*bbp.WhyAreTheseInline)); at += tmp5745.Size() + tmp := ((*bbp.WhyAreTheseInline)) + at += tmp.Size() return case 2: at += 1 bbp.Really = new(Really) (*bbp.Really) = MustMakeReallyFromBytes(buf[at:]) - tmp5753 := ((*bbp.Really)); at += tmp5753.Size() + tmp := ((*bbp.Really)) + at += tmp.Size() return default: return @@ -518,7 +532,7 @@ func (bbp *ImportedUnion) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err case 2: bbp.Really = new(Really) @@ -526,10 +540,10 @@ func (bbp *ImportedUnion) DecodeBebop(ior io.Reader) (err error) { if err != nil { return err } - io.ReadAll(r) + r.Drain() return r.Err default: - io.ReadAll(r) + r.Drain() return r.Err } } @@ -539,12 +553,14 @@ func (bbp ImportedUnion) Size() int { bodyLen := 4 if bbp.WhyAreTheseInline != nil { bodyLen += 1 - tmp5820 := (*bbp.WhyAreTheseInline); bodyLen += tmp5820.Size() + tmp := (*bbp.WhyAreTheseInline) + bodyLen += tmp.Size() return bodyLen } if bbp.Really != nil { bodyLen += 1 - tmp5829 := (*bbp.Really); bodyLen += tmp5829.Size() + tmp := (*bbp.Really) + bodyLen += tmp.Size() return bodyLen } return bodyLen @@ -556,7 +572,7 @@ func (bbp ImportedUnion) MarshalBebop() []byte { return buf } -func MakeImportedUnion(r iohelp.ErrorReader) (ImportedUnion, error) { +func MakeImportedUnion(r *iohelp.ErrorReader) (ImportedUnion, error) { v := ImportedUnion{} err := v.DecodeBebop(r) return v, err