testing/protopack: make package publicly available
Change-Id: I342ed27df17867f18c58e60880bcac5a31a3096b
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219837
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/encoding/protojson/encode_test.go b/encoding/protojson/encode_test.go
index df2fbc9..1e2ceb0 100644
--- a/encoding/protojson/encode_test.go
+++ b/encoding/protojson/encode_test.go
@@ -13,10 +13,10 @@
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/internal/detrand"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/proto"
preg "google.golang.org/protobuf/reflect/protoregistry"
+ "google.golang.org/protobuf/testing/protopack"
fieldmaskpb "google.golang.org/protobuf/internal/testprotos/fieldmaskpb"
pb2 "google.golang.org/protobuf/internal/testprotos/textpb2"
@@ -860,8 +860,8 @@
m := &pb2.Scalars{
OptString: proto.String("no unknowns"),
}
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{101, pack.BytesType}, pack.String("hello world"),
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{101, protopack.BytesType}, protopack.String("hello world"),
}.Marshal())
return m
}(),
diff --git a/encoding/prototext/encode_test.go b/encoding/prototext/encode_test.go
index 8b821e1..b910727 100644
--- a/encoding/prototext/encode_test.go
+++ b/encoding/prototext/encode_test.go
@@ -12,10 +12,10 @@
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/internal/detrand"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/proto"
preg "google.golang.org/protobuf/reflect/protoregistry"
+ "google.golang.org/protobuf/testing/protopack"
pb2 "google.golang.org/protobuf/internal/testprotos/textpb2"
pb3 "google.golang.org/protobuf/internal/testprotos/textpb3"
@@ -826,11 +826,11 @@
m := &pb2.Scalars{
OptString: proto.String("this message contains unknown fields"),
}
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{101, pack.VarintType}, pack.Bool(true),
- pack.Tag{102, pack.VarintType}, pack.Varint(0xff),
- pack.Tag{103, pack.Fixed32Type}, pack.Uint32(47),
- pack.Tag{104, pack.Fixed64Type}, pack.Int64(0xdeadbeef),
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{101, protopack.VarintType}, protopack.Bool(true),
+ protopack.Tag{102, protopack.VarintType}, protopack.Varint(0xff),
+ protopack.Tag{103, protopack.Fixed32Type}, protopack.Uint32(47),
+ protopack.Tag{104, protopack.Fixed64Type}, protopack.Int64(0xdeadbeef),
}.Marshal())
return m
}(),
@@ -843,11 +843,11 @@
m := &pb2.Scalars{
OptString: proto.String("this message contains unknown fields"),
}
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{101, pack.VarintType}, pack.Bool(true),
- pack.Tag{102, pack.VarintType}, pack.Varint(0xff),
- pack.Tag{103, pack.Fixed32Type}, pack.Uint32(0x47),
- pack.Tag{104, pack.Fixed64Type}, pack.Int64(0xdeadbeef),
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{101, protopack.VarintType}, protopack.Bool(true),
+ protopack.Tag{102, protopack.VarintType}, protopack.Varint(0xff),
+ protopack.Tag{103, protopack.Fixed32Type}, protopack.Uint32(0x47),
+ protopack.Tag{104, protopack.Fixed64Type}, protopack.Int64(0xdeadbeef),
}.Marshal())
return m
}(),
@@ -862,10 +862,10 @@
mo: prototext.MarshalOptions{EmitUnknown: true},
input: func() proto.Message {
m := new(pb2.Scalars)
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{101, pack.BytesType}, pack.LengthPrefix{pack.Bool(true), pack.Bool(false)},
- pack.Tag{102, pack.BytesType}, pack.String("hello world"),
- pack.Tag{103, pack.BytesType}, pack.Bytes("\xe4\xb8\x96\xe7\x95\x8c"),
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{101, protopack.BytesType}, protopack.LengthPrefix{protopack.Bool(true), protopack.Bool(false)},
+ protopack.Tag{102, protopack.BytesType}, protopack.String("hello world"),
+ protopack.Tag{103, protopack.BytesType}, protopack.Bytes("\xe4\xb8\x96\xe7\x95\x8c"),
}.Marshal())
return m
}(),
@@ -878,12 +878,12 @@
mo: prototext.MarshalOptions{EmitUnknown: true},
input: func() proto.Message {
m := new(pb2.Scalars)
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{101, pack.StartGroupType}, pack.Tag{101, pack.EndGroupType},
- pack.Tag{102, pack.StartGroupType},
- pack.Tag{101, pack.VarintType}, pack.Bool(false),
- pack.Tag{102, pack.BytesType}, pack.String("inside a group"),
- pack.Tag{102, pack.EndGroupType},
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{101, protopack.StartGroupType}, protopack.Tag{101, protopack.EndGroupType},
+ protopack.Tag{102, protopack.StartGroupType},
+ protopack.Tag{101, protopack.VarintType}, protopack.Bool(false),
+ protopack.Tag{102, protopack.BytesType}, protopack.String("inside a group"),
+ protopack.Tag{102, protopack.EndGroupType},
}.Marshal())
return m
}(),
@@ -898,11 +898,11 @@
mo: prototext.MarshalOptions{EmitUnknown: true},
input: func() proto.Message {
m := new(pb2.Scalars)
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{101, pack.BytesType}, pack.LengthPrefix{pack.Bool(true), pack.Bool(false), pack.Bool(true)},
- pack.Tag{102, pack.BytesType}, pack.String("hello"),
- pack.Tag{101, pack.VarintType}, pack.Bool(true),
- pack.Tag{102, pack.BytesType}, pack.String("世界"),
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{101, protopack.BytesType}, protopack.LengthPrefix{protopack.Bool(true), protopack.Bool(false), protopack.Bool(true)},
+ protopack.Tag{102, protopack.BytesType}, protopack.String("hello"),
+ protopack.Tag{101, protopack.VarintType}, protopack.Bool(true),
+ protopack.Tag{102, protopack.BytesType}, protopack.String("世界"),
}.Marshal())
return m
}(),
diff --git a/internal/cmd/pbdump/pbdump.go b/internal/cmd/pbdump/pbdump.go
index 456fdb6..87d6030 100644
--- a/internal/cmd/pbdump/pbdump.go
+++ b/internal/cmd/pbdump/pbdump.go
@@ -18,11 +18,11 @@
"strings"
"google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
+ "google.golang.org/protobuf/testing/protopack"
"google.golang.org/protobuf/types/descriptorpb"
)
@@ -127,7 +127,7 @@
// Parse and print message structure.
defer log.Printf("fatal input: %q", buf) // debug printout if panic occurs
- var m pack.Message
+ var m protopack.Message
m.UnmarshalDescriptor(buf, desc)
if *printSource {
fmt.Printf("%#v\n", m)
diff --git a/proto/decode_test.go b/proto/decode_test.go
index a6b7ce8..766c12d 100644
--- a/proto/decode_test.go
+++ b/proto/decode_test.go
@@ -11,9 +11,9 @@
"testing"
"google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
+ "google.golang.org/protobuf/testing/protopack"
testpb "google.golang.org/protobuf/internal/testprotos/test"
test3pb "google.golang.org/protobuf/internal/testprotos/test3"
@@ -91,8 +91,8 @@
func TestDecodeZeroLengthBytes(t *testing.T) {
// Verify that proto3 bytes fields don't give the mistaken
// impression that they preserve presence.
- wire := pack.Message{
- pack.Tag{15, pack.BytesType}, pack.Bytes(nil),
+ wire := protopack.Message{
+ protopack.Tag{15, protopack.BytesType}, protopack.Bytes(nil),
}.Marshal()
m := &test3pb.TestAllTypes{}
if err := proto.Unmarshal(wire, m); err != nil {
@@ -104,8 +104,8 @@
}
func TestDecodeOneofNilWrapper(t *testing.T) {
- wire := pack.Message{
- pack.Tag{111, pack.VarintType}, pack.Varint(1111),
+ wire := protopack.Message{
+ protopack.Tag{111, protopack.VarintType}, protopack.Varint(1111),
}.Marshal()
m := &testpb.TestAllTypes{OneofField: (*testpb.TestAllTypes_OneofUint32)(nil)}
if err := proto.Unmarshal(wire, m); err != nil {
@@ -121,8 +121,8 @@
// but we take care to produce non-nil []bytes for zero-length
// byte strings, so test for it.
m := &testpb.TestAllTypes{}
- b := pack.Message{
- pack.Tag{45, pack.BytesType}, pack.Bytes(nil),
+ b := protopack.Message{
+ protopack.Tag{45, protopack.BytesType}, protopack.Bytes(nil),
}.Marshal()
if err := proto.Unmarshal(b, m); err != nil {
t.Fatal(err)
diff --git a/proto/equal_test.go b/proto/equal_test.go
index 3ae5771..95ec497 100644
--- a/proto/equal_test.go
+++ b/proto/equal_test.go
@@ -9,8 +9,8 @@
"testing"
"google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/testing/protopack"
testpb "google.golang.org/protobuf/internal/testprotos/test"
test3pb "google.golang.org/protobuf/internal/testprotos/test3"
@@ -416,15 +416,15 @@
// Unknown fields.
{
- x: build(&testpb.TestAllTypes{}, unknown(pack.Message{
- pack.Tag{100000, pack.VarintType}, pack.Varint(1),
+ x: build(&testpb.TestAllTypes{}, unknown(protopack.Message{
+ protopack.Tag{100000, protopack.VarintType}, protopack.Varint(1),
}.Marshal())),
- y: build(&testpb.TestAllTypes{}, unknown(pack.Message{
- pack.Tag{100000, pack.VarintType}, pack.Varint(2),
+ y: build(&testpb.TestAllTypes{}, unknown(protopack.Message{
+ protopack.Tag{100000, protopack.VarintType}, protopack.Varint(2),
}.Marshal())),
}, {
- x: build(&testpb.TestAllTypes{}, unknown(pack.Message{
- pack.Tag{100000, pack.VarintType}, pack.Varint(1),
+ x: build(&testpb.TestAllTypes{}, unknown(protopack.Message{
+ protopack.Tag{100000, protopack.VarintType}, protopack.Varint(1),
}.Marshal())),
y: &testpb.TestAllTypes{},
},
diff --git a/proto/merge_test.go b/proto/merge_test.go
index 2f2b4ba..7cc2093 100644
--- a/proto/merge_test.go
+++ b/proto/merge_test.go
@@ -13,11 +13,11 @@
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/protobuild"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/testing/protocmp"
+ "google.golang.org/protobuf/testing/protopack"
"google.golang.org/protobuf/types/dynamicpb"
legacypb "google.golang.org/protobuf/internal/testprotos/legacy"
@@ -511,19 +511,19 @@
}, {
desc: "merge unknown fields",
dst: protobuild.Message{
- protobuild.Unknown: pack.Message{
- pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Svarint(-5),
+ protobuild.Unknown: protopack.Message{
+ protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Svarint(-5),
}.Marshal(),
},
src: protobuild.Message{
- protobuild.Unknown: pack.Message{
- pack.Tag{Number: 500000, Type: pack.VarintType}, pack.Svarint(-50),
+ protobuild.Unknown: protopack.Message{
+ protopack.Tag{Number: 500000, Type: protopack.VarintType}, protopack.Svarint(-50),
}.Marshal(),
},
want: protobuild.Message{
- protobuild.Unknown: pack.Message{
- pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Svarint(-5),
- pack.Tag{Number: 500000, Type: pack.VarintType}, pack.Svarint(-50),
+ protobuild.Unknown: protopack.Message{
+ protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Svarint(-5),
+ protopack.Tag{Number: 500000, Type: protopack.VarintType}, protopack.Svarint(-50),
}.Marshal(),
},
}, {
@@ -786,8 +786,8 @@
}},
func() *testpb.TestAllTypes {
m := new(testpb.TestAllTypes)
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Svarint(-5),
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Svarint(-5),
}.Marshal())
return m
}(),
@@ -816,8 +816,8 @@
A: proto.Int32(5),
},
}
- got.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Svarint(-5),
+ got.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Svarint(-5),
}.Marshal())
proto.Merge(got, got)
@@ -833,9 +833,9 @@
A: proto.Int32(5),
},
}
- want.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Svarint(-5),
- pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Svarint(-5),
+ want.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Svarint(-5),
+ protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Svarint(-5),
}.Marshal())
if !proto.Equal(got, want) {
diff --git a/proto/messageset_test.go b/proto/messageset_test.go
index 1418f4a..e634112 100644
--- a/proto/messageset_test.go
+++ b/proto/messageset_test.go
@@ -6,9 +6,9 @@
import (
"google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/testing/protopack"
messagesetpb "google.golang.org/protobuf/internal/testprotos/messageset/messagesetpb"
msetextpb "google.golang.org/protobuf/internal/testprotos/messageset/msetextpb"
@@ -31,14 +31,14 @@
})
return m
}()},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -51,14 +51,14 @@
})
return m
}()},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -70,34 +70,34 @@
Ext1Field1: proto.Int32(10),
}),
)},
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
// Unknown field
- pack.Tag{4, pack.VarintType}, pack.Varint(30),
+ protopack.Tag{4, protopack.VarintType}, protopack.Varint(30),
}.Marshal(),
},
{
desc: "MessageSet with unknown type_id",
decodeTo: []proto.Message{build(
&messagesetpb.MessageSet{},
- unknown(pack.Message{
- pack.Tag{999, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ unknown(protopack.Message{
+ protopack.Tag{999, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
}.Marshal()),
)},
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(999),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(999),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -109,16 +109,16 @@
Ext1Field2: proto.Int32(20),
}),
)},
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.VarintType}, pack.Varint(20),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(20),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -133,28 +133,28 @@
Ext2Field1: proto.Int32(30),
}),
)},
- wire: pack.Message{
+ wire: protopack.Message{
// Ext1, field1
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
// Ext2, field1
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1001),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(30),
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1001),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(30),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
// Ext2, field2
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.VarintType}, pack.Varint(20),
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(20),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -162,12 +162,12 @@
decodeTo: []proto.Message{build(
&messagesetpb.MessageSet{},
)},
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -176,10 +176,10 @@
&messagesetpb.MessageSet{},
extend(msetextpb.E_Ext1_MessageSetExtension, &msetextpb.Ext1{}),
)},
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -189,12 +189,12 @@
proto.SetExtension(m.MessageSet, msetextpb.E_ExtLargeNumber_MessageSetExtension, &msetextpb.ExtLargeNumber{})
return m
}()},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(protowire.MaxValidNumber + 1),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(protowire.MaxValidNumber + 1),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -203,18 +203,18 @@
decodeTo: []proto.Message{func() proto.Message {
m := &messagesetpb.MessageSetContainer{MessageSet: &messagesetpb.MessageSet{}}
m.MessageSet.ProtoReflect().SetUnknown(
- pack.Message{
- pack.Tag{protowire.MaxValidNumber + 2, pack.BytesType}, pack.LengthPrefix{},
+ protopack.Message{
+ protopack.Tag{protowire.MaxValidNumber + 2, protopack.BytesType}, protopack.LengthPrefix{},
}.Marshal(),
)
return m
}()},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(protowire.MaxValidNumber + 2),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(protowire.MaxValidNumber + 2),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -227,15 +227,15 @@
})
return m
}()},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1000),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(10),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1000),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(10),
}),
- pack.Tag{4, pack.VarintType}, pack.Varint(0),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{4, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -249,14 +249,14 @@
})
return m
}()},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1002),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1002),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{1, pack.EndGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -269,12 +269,12 @@
proto.SetExtension(m.MessageSet, msetextpb.E_ExtRequired_MessageSetExtension, &msetextpb.ExtRequired{})
return m
}()},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1002),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1002),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -286,12 +286,12 @@
decodeTo: []proto.Message{
(*messagesetpb.MessageSetContainer)(nil),
},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Uvarint(0),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Uvarint(0),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
@@ -300,12 +300,12 @@
decodeTo: []proto.Message{
(*messagesetpb.MessageSetContainer)(nil),
},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Uvarint(0x80000000),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Uvarint(0x80000000),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{1, protopack.EndGroupType},
}),
}.Marshal(),
},
diff --git a/proto/noenforceutf8_test.go b/proto/noenforceutf8_test.go
index f41b35a..2bd011e 100644
--- a/proto/noenforceutf8_test.go
+++ b/proto/noenforceutf8_test.go
@@ -8,13 +8,13 @@
"reflect"
"google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/filedesc"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoimpl"
+ "google.golang.org/protobuf/testing/protopack"
"google.golang.org/protobuf/types/descriptorpb"
)
@@ -33,8 +33,8 @@
decodeTo: []proto.Message{&TestNoEnforceUTF8{
OptionalString: string("abc\xff"),
}},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("abc\xff"),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("abc\xff"),
}.Marshal(),
},
{
@@ -42,8 +42,8 @@
decodeTo: []proto.Message{&TestNoEnforceUTF8{
OptionalBytes: []byte("abc\xff"),
}},
- wire: pack.Message{
- pack.Tag{2, pack.BytesType}, pack.String("abc\xff"),
+ wire: protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.String("abc\xff"),
}.Marshal(),
},
{
@@ -51,9 +51,9 @@
decodeTo: []proto.Message{&TestNoEnforceUTF8{
RepeatedString: []string{string("foo"), string("abc\xff")},
}},
- wire: pack.Message{
- pack.Tag{3, pack.BytesType}, pack.String("foo"),
- pack.Tag{3, pack.BytesType}, pack.String("abc\xff"),
+ wire: protopack.Message{
+ protopack.Tag{3, protopack.BytesType}, protopack.String("foo"),
+ protopack.Tag{3, protopack.BytesType}, protopack.String("abc\xff"),
}.Marshal(),
},
{
@@ -61,9 +61,9 @@
decodeTo: []proto.Message{&TestNoEnforceUTF8{
RepeatedBytes: [][]byte{[]byte("foo"), []byte("abc\xff")},
}},
- wire: pack.Message{
- pack.Tag{4, pack.BytesType}, pack.String("foo"),
- pack.Tag{4, pack.BytesType}, pack.String("abc\xff"),
+ wire: protopack.Message{
+ protopack.Tag{4, protopack.BytesType}, protopack.String("foo"),
+ protopack.Tag{4, protopack.BytesType}, protopack.String("abc\xff"),
}.Marshal(),
},
{
@@ -71,14 +71,14 @@
decodeTo: []proto.Message{
&TestNoEnforceUTF8{OneofField: &TestNoEnforceUTF8_OneofString{string("abc\xff")}},
},
- wire: pack.Message{pack.Tag{5, pack.BytesType}, pack.String("abc\xff")}.Marshal(),
+ wire: protopack.Message{protopack.Tag{5, protopack.BytesType}, protopack.String("abc\xff")}.Marshal(),
},
{
desc: "invalid UTF-8 in oneof string field of Go bytes",
decodeTo: []proto.Message{
&TestNoEnforceUTF8{OneofField: &TestNoEnforceUTF8_OneofBytes{[]byte("abc\xff")}},
},
- wire: pack.Message{pack.Tag{6, pack.BytesType}, pack.String("abc\xff")}.Marshal(),
+ wire: protopack.Message{protopack.Tag{6, protopack.BytesType}, protopack.String("abc\xff")}.Marshal(),
},
}
diff --git a/proto/testmessages_test.go b/proto/testmessages_test.go
index 680faf6..b0090fe 100644
--- a/proto/testmessages_test.go
+++ b/proto/testmessages_test.go
@@ -6,12 +6,12 @@
import (
"google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/impl"
"google.golang.org/protobuf/internal/protobuild"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
+ "google.golang.org/protobuf/testing/protopack"
legacypb "google.golang.org/protobuf/internal/testprotos/legacy"
requiredpb "google.golang.org/protobuf/internal/testprotos/required"
@@ -83,23 +83,23 @@
"optional_bytes": []byte("bytes"),
"optional_nested_enum": "BAR",
}),
- wire: pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1001),
- pack.Tag{2, pack.VarintType}, pack.Varint(1002),
- pack.Tag{3, pack.VarintType}, pack.Uvarint(1003),
- pack.Tag{4, pack.VarintType}, pack.Uvarint(1004),
- pack.Tag{5, pack.VarintType}, pack.Svarint(1005),
- pack.Tag{6, pack.VarintType}, pack.Svarint(1006),
- pack.Tag{7, pack.Fixed32Type}, pack.Uint32(1007),
- pack.Tag{8, pack.Fixed64Type}, pack.Uint64(1008),
- pack.Tag{9, pack.Fixed32Type}, pack.Int32(1009),
- pack.Tag{10, pack.Fixed64Type}, pack.Int64(1010),
- pack.Tag{11, pack.Fixed32Type}, pack.Float32(1011.5),
- pack.Tag{12, pack.Fixed64Type}, pack.Float64(1012.5),
- pack.Tag{13, pack.VarintType}, pack.Bool(true),
- pack.Tag{14, pack.BytesType}, pack.String("string"),
- pack.Tag{15, pack.BytesType}, pack.Bytes([]byte("bytes")),
- pack.Tag{21, pack.VarintType}, pack.Varint(int(testpb.TestAllTypes_BAR)),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1001),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1002),
+ protopack.Tag{3, protopack.VarintType}, protopack.Uvarint(1003),
+ protopack.Tag{4, protopack.VarintType}, protopack.Uvarint(1004),
+ protopack.Tag{5, protopack.VarintType}, protopack.Svarint(1005),
+ protopack.Tag{6, protopack.VarintType}, protopack.Svarint(1006),
+ protopack.Tag{7, protopack.Fixed32Type}, protopack.Uint32(1007),
+ protopack.Tag{8, protopack.Fixed64Type}, protopack.Uint64(1008),
+ protopack.Tag{9, protopack.Fixed32Type}, protopack.Int32(1009),
+ protopack.Tag{10, protopack.Fixed64Type}, protopack.Int64(1010),
+ protopack.Tag{11, protopack.Fixed32Type}, protopack.Float32(1011.5),
+ protopack.Tag{12, protopack.Fixed64Type}, protopack.Float64(1012.5),
+ protopack.Tag{13, protopack.VarintType}, protopack.Bool(true),
+ protopack.Tag{14, protopack.BytesType}, protopack.String("string"),
+ protopack.Tag{15, protopack.BytesType}, protopack.Bytes([]byte("bytes")),
+ protopack.Tag{21, protopack.VarintType}, protopack.Varint(int(testpb.TestAllTypes_BAR)),
}.Marshal(),
},
{
@@ -121,22 +121,22 @@
"optional_string": "",
"optional_bytes": []byte{},
}),
- wire: pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(0),
- pack.Tag{2, pack.VarintType}, pack.Varint(0),
- pack.Tag{3, pack.VarintType}, pack.Uvarint(0),
- pack.Tag{4, pack.VarintType}, pack.Uvarint(0),
- pack.Tag{5, pack.VarintType}, pack.Svarint(0),
- pack.Tag{6, pack.VarintType}, pack.Svarint(0),
- pack.Tag{7, pack.Fixed32Type}, pack.Uint32(0),
- pack.Tag{8, pack.Fixed64Type}, pack.Uint64(0),
- pack.Tag{9, pack.Fixed32Type}, pack.Int32(0),
- pack.Tag{10, pack.Fixed64Type}, pack.Int64(0),
- pack.Tag{11, pack.Fixed32Type}, pack.Float32(0),
- pack.Tag{12, pack.Fixed64Type}, pack.Float64(0),
- pack.Tag{13, pack.VarintType}, pack.Bool(false),
- pack.Tag{14, pack.BytesType}, pack.String(""),
- pack.Tag{15, pack.BytesType}, pack.Bytes(nil),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{3, protopack.VarintType}, protopack.Uvarint(0),
+ protopack.Tag{4, protopack.VarintType}, protopack.Uvarint(0),
+ protopack.Tag{5, protopack.VarintType}, protopack.Svarint(0),
+ protopack.Tag{6, protopack.VarintType}, protopack.Svarint(0),
+ protopack.Tag{7, protopack.Fixed32Type}, protopack.Uint32(0),
+ protopack.Tag{8, protopack.Fixed64Type}, protopack.Uint64(0),
+ protopack.Tag{9, protopack.Fixed32Type}, protopack.Int32(0),
+ protopack.Tag{10, protopack.Fixed64Type}, protopack.Int64(0),
+ protopack.Tag{11, protopack.Fixed32Type}, protopack.Float32(0),
+ protopack.Tag{12, protopack.Fixed64Type}, protopack.Float64(0),
+ protopack.Tag{13, protopack.VarintType}, protopack.Bool(false),
+ protopack.Tag{14, protopack.BytesType}, protopack.String(""),
+ protopack.Tag{15, protopack.BytesType}, protopack.Bytes(nil),
}.Marshal(),
},
{
@@ -147,11 +147,11 @@
"same_field_number": 1016,
},
}, &testpb.TestAllTypes{}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{16, pack.StartGroupType},
- pack.Tag{17, pack.VarintType}, pack.Varint(1017),
- pack.Tag{16, pack.VarintType}, pack.Varint(1016),
- pack.Tag{16, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{16, protopack.StartGroupType},
+ protopack.Tag{17, protopack.VarintType}, protopack.Varint(1017),
+ protopack.Tag{16, protopack.VarintType}, protopack.Varint(1016),
+ protopack.Tag{16, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -161,13 +161,13 @@
"a": 2,
},
}, &testpb.TestAllTypes{}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{16, pack.StartGroupType},
- pack.Tag{17, pack.VarintType}, pack.Varint(1),
- pack.Tag{16, pack.EndGroupType},
- pack.Tag{16, pack.StartGroupType},
- pack.Tag{17, pack.VarintType}, pack.Varint(2),
- pack.Tag{16, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{16, protopack.StartGroupType},
+ protopack.Tag{17, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{16, protopack.EndGroupType},
+ protopack.Tag{16, protopack.StartGroupType},
+ protopack.Tag{17, protopack.VarintType}, protopack.Varint(2),
+ protopack.Tag{16, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -180,11 +180,11 @@
},
},
}),
- wire: pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(42),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(43),
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(42),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(43),
}),
}),
}.Marshal(),
@@ -199,13 +199,13 @@
},
},
}),
- wire: pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(42),
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(42),
}),
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(43),
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(43),
}),
}),
}.Marshal(),
@@ -217,12 +217,12 @@
"a": 2,
},
}),
- wire: pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
}),
}.Marshal(),
},
@@ -246,39 +246,39 @@
"repeated_bytes": []string{"FOO", "BAR"},
"repeated_nested_enum": []string{"FOO", "BAR"},
}),
- wire: pack.Message{
- pack.Tag{31, pack.VarintType}, pack.Varint(1001),
- pack.Tag{31, pack.VarintType}, pack.Varint(2001),
- pack.Tag{32, pack.VarintType}, pack.Varint(1002),
- pack.Tag{32, pack.VarintType}, pack.Varint(2002),
- pack.Tag{33, pack.VarintType}, pack.Uvarint(1003),
- pack.Tag{33, pack.VarintType}, pack.Uvarint(2003),
- pack.Tag{34, pack.VarintType}, pack.Uvarint(1004),
- pack.Tag{34, pack.VarintType}, pack.Uvarint(2004),
- pack.Tag{35, pack.VarintType}, pack.Svarint(1005),
- pack.Tag{35, pack.VarintType}, pack.Svarint(2005),
- pack.Tag{36, pack.VarintType}, pack.Svarint(1006),
- pack.Tag{36, pack.VarintType}, pack.Svarint(2006),
- pack.Tag{37, pack.Fixed32Type}, pack.Uint32(1007),
- pack.Tag{37, pack.Fixed32Type}, pack.Uint32(2007),
- pack.Tag{38, pack.Fixed64Type}, pack.Uint64(1008),
- pack.Tag{38, pack.Fixed64Type}, pack.Uint64(2008),
- pack.Tag{39, pack.Fixed32Type}, pack.Int32(1009),
- pack.Tag{39, pack.Fixed32Type}, pack.Int32(2009),
- pack.Tag{40, pack.Fixed64Type}, pack.Int64(1010),
- pack.Tag{40, pack.Fixed64Type}, pack.Int64(2010),
- pack.Tag{41, pack.Fixed32Type}, pack.Float32(1011.5),
- pack.Tag{41, pack.Fixed32Type}, pack.Float32(2011.5),
- pack.Tag{42, pack.Fixed64Type}, pack.Float64(1012.5),
- pack.Tag{42, pack.Fixed64Type}, pack.Float64(2012.5),
- pack.Tag{43, pack.VarintType}, pack.Bool(true),
- pack.Tag{43, pack.VarintType}, pack.Bool(false),
- pack.Tag{44, pack.BytesType}, pack.String("foo"),
- pack.Tag{44, pack.BytesType}, pack.String("bar"),
- pack.Tag{45, pack.BytesType}, pack.Bytes([]byte("FOO")),
- pack.Tag{45, pack.BytesType}, pack.Bytes([]byte("BAR")),
- pack.Tag{51, pack.VarintType}, pack.Varint(int(testpb.TestAllTypes_FOO)),
- pack.Tag{51, pack.VarintType}, pack.Varint(int(testpb.TestAllTypes_BAR)),
+ wire: protopack.Message{
+ protopack.Tag{31, protopack.VarintType}, protopack.Varint(1001),
+ protopack.Tag{31, protopack.VarintType}, protopack.Varint(2001),
+ protopack.Tag{32, protopack.VarintType}, protopack.Varint(1002),
+ protopack.Tag{32, protopack.VarintType}, protopack.Varint(2002),
+ protopack.Tag{33, protopack.VarintType}, protopack.Uvarint(1003),
+ protopack.Tag{33, protopack.VarintType}, protopack.Uvarint(2003),
+ protopack.Tag{34, protopack.VarintType}, protopack.Uvarint(1004),
+ protopack.Tag{34, protopack.VarintType}, protopack.Uvarint(2004),
+ protopack.Tag{35, protopack.VarintType}, protopack.Svarint(1005),
+ protopack.Tag{35, protopack.VarintType}, protopack.Svarint(2005),
+ protopack.Tag{36, protopack.VarintType}, protopack.Svarint(1006),
+ protopack.Tag{36, protopack.VarintType}, protopack.Svarint(2006),
+ protopack.Tag{37, protopack.Fixed32Type}, protopack.Uint32(1007),
+ protopack.Tag{37, protopack.Fixed32Type}, protopack.Uint32(2007),
+ protopack.Tag{38, protopack.Fixed64Type}, protopack.Uint64(1008),
+ protopack.Tag{38, protopack.Fixed64Type}, protopack.Uint64(2008),
+ protopack.Tag{39, protopack.Fixed32Type}, protopack.Int32(1009),
+ protopack.Tag{39, protopack.Fixed32Type}, protopack.Int32(2009),
+ protopack.Tag{40, protopack.Fixed64Type}, protopack.Int64(1010),
+ protopack.Tag{40, protopack.Fixed64Type}, protopack.Int64(2010),
+ protopack.Tag{41, protopack.Fixed32Type}, protopack.Float32(1011.5),
+ protopack.Tag{41, protopack.Fixed32Type}, protopack.Float32(2011.5),
+ protopack.Tag{42, protopack.Fixed64Type}, protopack.Float64(1012.5),
+ protopack.Tag{42, protopack.Fixed64Type}, protopack.Float64(2012.5),
+ protopack.Tag{43, protopack.VarintType}, protopack.Bool(true),
+ protopack.Tag{43, protopack.VarintType}, protopack.Bool(false),
+ protopack.Tag{44, protopack.BytesType}, protopack.String("foo"),
+ protopack.Tag{44, protopack.BytesType}, protopack.String("bar"),
+ protopack.Tag{45, protopack.BytesType}, protopack.Bytes([]byte("FOO")),
+ protopack.Tag{45, protopack.BytesType}, protopack.Bytes([]byte("BAR")),
+ protopack.Tag{51, protopack.VarintType}, protopack.Varint(int(testpb.TestAllTypes_FOO)),
+ protopack.Tag{51, protopack.VarintType}, protopack.Varint(int(testpb.TestAllTypes_BAR)),
}.Marshal(),
},
{
@@ -299,49 +299,49 @@
"repeated_bool": []bool{true, false},
"repeated_nested_enum": []string{"FOO", "BAR"},
}),
- wire: pack.Message{
- pack.Tag{31, pack.BytesType}, pack.LengthPrefix{
- pack.Varint(1001), pack.Varint(2001),
+ wire: protopack.Message{
+ protopack.Tag{31, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Varint(1001), protopack.Varint(2001),
},
- pack.Tag{32, pack.BytesType}, pack.LengthPrefix{
- pack.Varint(1002), pack.Varint(2002),
+ protopack.Tag{32, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Varint(1002), protopack.Varint(2002),
},
- pack.Tag{33, pack.BytesType}, pack.LengthPrefix{
- pack.Uvarint(1003), pack.Uvarint(2003),
+ protopack.Tag{33, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uvarint(1003), protopack.Uvarint(2003),
},
- pack.Tag{34, pack.BytesType}, pack.LengthPrefix{
- pack.Uvarint(1004), pack.Uvarint(2004),
+ protopack.Tag{34, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uvarint(1004), protopack.Uvarint(2004),
},
- pack.Tag{35, pack.BytesType}, pack.LengthPrefix{
- pack.Svarint(1005), pack.Svarint(2005),
+ protopack.Tag{35, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Svarint(1005), protopack.Svarint(2005),
},
- pack.Tag{36, pack.BytesType}, pack.LengthPrefix{
- pack.Svarint(1006), pack.Svarint(2006),
+ protopack.Tag{36, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Svarint(1006), protopack.Svarint(2006),
},
- pack.Tag{37, pack.BytesType}, pack.LengthPrefix{
- pack.Uint32(1007), pack.Uint32(2007),
+ protopack.Tag{37, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uint32(1007), protopack.Uint32(2007),
},
- pack.Tag{38, pack.BytesType}, pack.LengthPrefix{
- pack.Uint64(1008), pack.Uint64(2008),
+ protopack.Tag{38, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uint64(1008), protopack.Uint64(2008),
},
- pack.Tag{39, pack.BytesType}, pack.LengthPrefix{
- pack.Int32(1009), pack.Int32(2009),
+ protopack.Tag{39, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Int32(1009), protopack.Int32(2009),
},
- pack.Tag{40, pack.BytesType}, pack.LengthPrefix{
- pack.Int64(1010), pack.Int64(2010),
+ protopack.Tag{40, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Int64(1010), protopack.Int64(2010),
},
- pack.Tag{41, pack.BytesType}, pack.LengthPrefix{
- pack.Float32(1011.5), pack.Float32(2011.5),
+ protopack.Tag{41, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Float32(1011.5), protopack.Float32(2011.5),
},
- pack.Tag{42, pack.BytesType}, pack.LengthPrefix{
- pack.Float64(1012.5), pack.Float64(2012.5),
+ protopack.Tag{42, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Float64(1012.5), protopack.Float64(2012.5),
},
- pack.Tag{43, pack.BytesType}, pack.LengthPrefix{
- pack.Bool(true), pack.Bool(false),
+ protopack.Tag{43, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Bool(true), protopack.Bool(false),
},
- pack.Tag{51, pack.BytesType}, pack.LengthPrefix{
- pack.Varint(int(testpb.TestAllTypes_FOO)),
- pack.Varint(int(testpb.TestAllTypes_BAR)),
+ protopack.Tag{51, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Varint(int(testpb.TestAllTypes_FOO)),
+ protopack.Varint(int(testpb.TestAllTypes_BAR)),
},
}.Marshal(),
},
@@ -363,21 +363,21 @@
"repeated_bool": []bool{},
"repeated_nested_enum": []string{},
}),
- wire: pack.Message{
- pack.Tag{31, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{32, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{33, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{34, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{35, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{36, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{37, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{38, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{39, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{40, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{41, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{42, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{43, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{51, pack.BytesType}, pack.LengthPrefix{},
+ wire: protopack.Message{
+ protopack.Tag{31, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{32, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{33, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{34, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{35, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{36, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{37, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{38, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{39, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{40, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{41, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{42, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{43, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{51, protopack.BytesType}, protopack.LengthPrefix{},
}.Marshal(),
},
{
@@ -398,49 +398,49 @@
"packed_bool": []bool{true, false},
"packed_enum": []string{"FOREIGN_FOO", "FOREIGN_BAR"},
}, &testpb.TestPackedTypes{}, &testpb.TestPackedExtensions{}),
- wire: pack.Message{
- pack.Tag{90, pack.BytesType}, pack.LengthPrefix{
- pack.Varint(1001), pack.Varint(2001),
+ wire: protopack.Message{
+ protopack.Tag{90, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Varint(1001), protopack.Varint(2001),
},
- pack.Tag{91, pack.BytesType}, pack.LengthPrefix{
- pack.Varint(1002), pack.Varint(2002),
+ protopack.Tag{91, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Varint(1002), protopack.Varint(2002),
},
- pack.Tag{92, pack.BytesType}, pack.LengthPrefix{
- pack.Uvarint(1003), pack.Uvarint(2003),
+ protopack.Tag{92, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uvarint(1003), protopack.Uvarint(2003),
},
- pack.Tag{93, pack.BytesType}, pack.LengthPrefix{
- pack.Uvarint(1004), pack.Uvarint(2004),
+ protopack.Tag{93, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uvarint(1004), protopack.Uvarint(2004),
},
- pack.Tag{94, pack.BytesType}, pack.LengthPrefix{
- pack.Svarint(1005), pack.Svarint(2005),
+ protopack.Tag{94, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Svarint(1005), protopack.Svarint(2005),
},
- pack.Tag{95, pack.BytesType}, pack.LengthPrefix{
- pack.Svarint(1006), pack.Svarint(2006),
+ protopack.Tag{95, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Svarint(1006), protopack.Svarint(2006),
},
- pack.Tag{96, pack.BytesType}, pack.LengthPrefix{
- pack.Uint32(1007), pack.Uint32(2007),
+ protopack.Tag{96, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uint32(1007), protopack.Uint32(2007),
},
- pack.Tag{97, pack.BytesType}, pack.LengthPrefix{
- pack.Uint64(1008), pack.Uint64(2008),
+ protopack.Tag{97, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Uint64(1008), protopack.Uint64(2008),
},
- pack.Tag{98, pack.BytesType}, pack.LengthPrefix{
- pack.Int32(1009), pack.Int32(2009),
+ protopack.Tag{98, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Int32(1009), protopack.Int32(2009),
},
- pack.Tag{99, pack.BytesType}, pack.LengthPrefix{
- pack.Int64(1010), pack.Int64(2010),
+ protopack.Tag{99, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Int64(1010), protopack.Int64(2010),
},
- pack.Tag{100, pack.BytesType}, pack.LengthPrefix{
- pack.Float32(1011.5), pack.Float32(2011.5),
+ protopack.Tag{100, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Float32(1011.5), protopack.Float32(2011.5),
},
- pack.Tag{101, pack.BytesType}, pack.LengthPrefix{
- pack.Float64(1012.5), pack.Float64(2012.5),
+ protopack.Tag{101, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Float64(1012.5), protopack.Float64(2012.5),
},
- pack.Tag{102, pack.BytesType}, pack.LengthPrefix{
- pack.Bool(true), pack.Bool(false),
+ protopack.Tag{102, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Bool(true), protopack.Bool(false),
},
- pack.Tag{103, pack.BytesType}, pack.LengthPrefix{
- pack.Varint(int(testpb.ForeignEnum_FOREIGN_FOO)),
- pack.Varint(int(testpb.ForeignEnum_FOREIGN_BAR)),
+ protopack.Tag{103, protopack.BytesType}, protopack.LengthPrefix{
+ protopack.Varint(int(testpb.ForeignEnum_FOREIGN_FOO)),
+ protopack.Varint(int(testpb.ForeignEnum_FOREIGN_BAR)),
},
}.Marshal(),
},
@@ -462,21 +462,21 @@
"packed_bool": []bool{},
"packed_enum": []string{},
}, &testpb.TestPackedTypes{}, &testpb.TestPackedExtensions{}),
- wire: pack.Message{
- pack.Tag{90, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{91, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{92, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{93, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{94, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{95, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{96, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{97, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{98, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{99, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{100, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{101, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{102, pack.BytesType}, pack.LengthPrefix{},
- pack.Tag{103, pack.BytesType}, pack.LengthPrefix{},
+ wire: protopack.Message{
+ protopack.Tag{90, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{91, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{92, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{93, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{94, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{95, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{96, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{97, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{98, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{99, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{100, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{101, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{102, protopack.BytesType}, protopack.LengthPrefix{},
+ protopack.Tag{103, protopack.BytesType}, protopack.LengthPrefix{},
}.Marshal(),
},
{
@@ -488,13 +488,13 @@
{"a": 2},
},
}),
- wire: pack.Message{
- pack.Tag{48, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{48, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{48, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{48, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
+ protopack.Tag{48, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{48, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
}),
}.Marshal(),
},
@@ -520,13 +520,13 @@
{A: proto.Int32(2)},
}),
)},
- wire: pack.Message{
- pack.Tag{48, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{48, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{48, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{48, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
+ protopack.Tag{48, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{48, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
}),
}.Marshal(),
},
@@ -539,15 +539,15 @@
{"a": 2017},
},
}, &testpb.TestAllTypes{}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{46, pack.StartGroupType},
- pack.Tag{47, pack.VarintType}, pack.Varint(1017),
- pack.Tag{46, pack.EndGroupType},
- pack.Tag{46, pack.StartGroupType},
- pack.Tag{46, pack.EndGroupType},
- pack.Tag{46, pack.StartGroupType},
- pack.Tag{47, pack.VarintType}, pack.Varint(2017),
- pack.Tag{46, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{46, protopack.StartGroupType},
+ protopack.Tag{47, protopack.VarintType}, protopack.Varint(1017),
+ protopack.Tag{46, protopack.EndGroupType},
+ protopack.Tag{46, protopack.StartGroupType},
+ protopack.Tag{46, protopack.EndGroupType},
+ protopack.Tag{46, protopack.StartGroupType},
+ protopack.Tag{47, protopack.VarintType}, protopack.Varint(2017),
+ protopack.Tag{46, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -566,15 +566,15 @@
{A: proto.Int32(2017)},
}),
)},
- wire: pack.Message{
- pack.Tag{46, pack.StartGroupType},
- pack.Tag{47, pack.VarintType}, pack.Varint(1017),
- pack.Tag{46, pack.EndGroupType},
- pack.Tag{46, pack.StartGroupType},
- pack.Tag{46, pack.EndGroupType},
- pack.Tag{46, pack.StartGroupType},
- pack.Tag{47, pack.VarintType}, pack.Varint(2017),
- pack.Tag{46, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{46, protopack.StartGroupType},
+ protopack.Tag{47, protopack.VarintType}, protopack.Varint(1017),
+ protopack.Tag{46, protopack.EndGroupType},
+ protopack.Tag{46, protopack.StartGroupType},
+ protopack.Tag{46, protopack.EndGroupType},
+ protopack.Tag{46, protopack.StartGroupType},
+ protopack.Tag{47, protopack.VarintType}, protopack.Varint(2017),
+ protopack.Tag{46, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -601,146 +601,146 @@
},
"map_string_nested_enum": map[string]string{"73.1.key": "FOO", "73.2.key": "BAR"},
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{56, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1056),
- pack.Tag{2, pack.VarintType}, pack.Varint(1156),
+ wire: protopack.Message{
+ protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1056),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1156),
}),
- pack.Tag{56, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2056),
- pack.Tag{2, pack.VarintType}, pack.Varint(2156),
+ protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2056),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(2156),
}),
- pack.Tag{57, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1057),
- pack.Tag{2, pack.VarintType}, pack.Varint(1157),
+ protopack.Tag{57, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1057),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1157),
}),
- pack.Tag{57, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2057),
- pack.Tag{2, pack.VarintType}, pack.Varint(2157),
+ protopack.Tag{57, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2057),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(2157),
}),
- pack.Tag{58, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1058),
- pack.Tag{2, pack.VarintType}, pack.Varint(1158),
+ protopack.Tag{58, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1058),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1158),
}),
- pack.Tag{58, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2058),
- pack.Tag{2, pack.VarintType}, pack.Varint(2158),
+ protopack.Tag{58, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2058),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(2158),
}),
- pack.Tag{59, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1059),
- pack.Tag{2, pack.VarintType}, pack.Varint(1159),
+ protopack.Tag{59, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1059),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1159),
}),
- pack.Tag{59, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2059),
- pack.Tag{2, pack.VarintType}, pack.Varint(2159),
+ protopack.Tag{59, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2059),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(2159),
}),
- pack.Tag{60, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Svarint(1060),
- pack.Tag{2, pack.VarintType}, pack.Svarint(1160),
+ protopack.Tag{60, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Svarint(1060),
+ protopack.Tag{2, protopack.VarintType}, protopack.Svarint(1160),
}),
- pack.Tag{60, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Svarint(2060),
- pack.Tag{2, pack.VarintType}, pack.Svarint(2160),
+ protopack.Tag{60, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Svarint(2060),
+ protopack.Tag{2, protopack.VarintType}, protopack.Svarint(2160),
}),
- pack.Tag{61, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Svarint(1061),
- pack.Tag{2, pack.VarintType}, pack.Svarint(1161),
+ protopack.Tag{61, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Svarint(1061),
+ protopack.Tag{2, protopack.VarintType}, protopack.Svarint(1161),
}),
- pack.Tag{61, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Svarint(2061),
- pack.Tag{2, pack.VarintType}, pack.Svarint(2161),
+ protopack.Tag{61, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Svarint(2061),
+ protopack.Tag{2, protopack.VarintType}, protopack.Svarint(2161),
}),
- pack.Tag{62, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed32Type}, pack.Int32(1062),
- pack.Tag{2, pack.Fixed32Type}, pack.Int32(1162),
+ protopack.Tag{62, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed32Type}, protopack.Int32(1062),
+ protopack.Tag{2, protopack.Fixed32Type}, protopack.Int32(1162),
}),
- pack.Tag{62, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed32Type}, pack.Int32(2062),
- pack.Tag{2, pack.Fixed32Type}, pack.Int32(2162),
+ protopack.Tag{62, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed32Type}, protopack.Int32(2062),
+ protopack.Tag{2, protopack.Fixed32Type}, protopack.Int32(2162),
}),
- pack.Tag{63, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed64Type}, pack.Int64(1063),
- pack.Tag{2, pack.Fixed64Type}, pack.Int64(1163),
+ protopack.Tag{63, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed64Type}, protopack.Int64(1063),
+ protopack.Tag{2, protopack.Fixed64Type}, protopack.Int64(1163),
}),
- pack.Tag{63, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed64Type}, pack.Int64(2063),
- pack.Tag{2, pack.Fixed64Type}, pack.Int64(2163),
+ protopack.Tag{63, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed64Type}, protopack.Int64(2063),
+ protopack.Tag{2, protopack.Fixed64Type}, protopack.Int64(2163),
}),
- pack.Tag{64, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed32Type}, pack.Int32(1064),
- pack.Tag{2, pack.Fixed32Type}, pack.Int32(1164),
+ protopack.Tag{64, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed32Type}, protopack.Int32(1064),
+ protopack.Tag{2, protopack.Fixed32Type}, protopack.Int32(1164),
}),
- pack.Tag{64, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed32Type}, pack.Int32(2064),
- pack.Tag{2, pack.Fixed32Type}, pack.Int32(2164),
+ protopack.Tag{64, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed32Type}, protopack.Int32(2064),
+ protopack.Tag{2, protopack.Fixed32Type}, protopack.Int32(2164),
}),
- pack.Tag{65, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed64Type}, pack.Int64(1065),
- pack.Tag{2, pack.Fixed64Type}, pack.Int64(1165),
+ protopack.Tag{65, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed64Type}, protopack.Int64(1065),
+ protopack.Tag{2, protopack.Fixed64Type}, protopack.Int64(1165),
}),
- pack.Tag{65, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.Fixed64Type}, pack.Int64(2065),
- pack.Tag{2, pack.Fixed64Type}, pack.Int64(2165),
+ protopack.Tag{65, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.Fixed64Type}, protopack.Int64(2065),
+ protopack.Tag{2, protopack.Fixed64Type}, protopack.Int64(2165),
}),
- pack.Tag{66, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1066),
- pack.Tag{2, pack.Fixed32Type}, pack.Float32(1166.5),
+ protopack.Tag{66, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1066),
+ protopack.Tag{2, protopack.Fixed32Type}, protopack.Float32(1166.5),
}),
- pack.Tag{66, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2066),
- pack.Tag{2, pack.Fixed32Type}, pack.Float32(2166.5),
+ protopack.Tag{66, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2066),
+ protopack.Tag{2, protopack.Fixed32Type}, protopack.Float32(2166.5),
}),
- pack.Tag{67, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1067),
- pack.Tag{2, pack.Fixed64Type}, pack.Float64(1167.5),
+ protopack.Tag{67, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1067),
+ protopack.Tag{2, protopack.Fixed64Type}, protopack.Float64(1167.5),
}),
- pack.Tag{67, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2067),
- pack.Tag{2, pack.Fixed64Type}, pack.Float64(2167.5),
+ protopack.Tag{67, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2067),
+ protopack.Tag{2, protopack.Fixed64Type}, protopack.Float64(2167.5),
}),
- pack.Tag{68, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Bool(true),
- pack.Tag{2, pack.VarintType}, pack.Bool(false),
+ protopack.Tag{68, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Bool(true),
+ protopack.Tag{2, protopack.VarintType}, protopack.Bool(false),
}),
- pack.Tag{68, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Bool(false),
- pack.Tag{2, pack.VarintType}, pack.Bool(true),
+ protopack.Tag{68, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Bool(false),
+ protopack.Tag{2, protopack.VarintType}, protopack.Bool(true),
}),
- pack.Tag{69, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("69.1.key"),
- pack.Tag{2, pack.BytesType}, pack.String("69.1.val"),
+ protopack.Tag{69, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("69.1.key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.String("69.1.val"),
}),
- pack.Tag{69, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("69.2.key"),
- pack.Tag{2, pack.BytesType}, pack.String("69.2.val"),
+ protopack.Tag{69, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("69.2.key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.String("69.2.val"),
}),
- pack.Tag{70, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("70.1.key"),
- pack.Tag{2, pack.BytesType}, pack.String("70.1.val"),
+ protopack.Tag{70, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("70.1.key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.String("70.1.val"),
}),
- pack.Tag{70, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("70.2.key"),
- pack.Tag{2, pack.BytesType}, pack.String("70.2.val"),
+ protopack.Tag{70, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("70.2.key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.String("70.2.val"),
}),
- pack.Tag{71, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("71.1.key"),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1171),
+ protopack.Tag{71, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("71.1.key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1171),
}),
}),
- pack.Tag{71, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("71.2.key"),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2171),
+ protopack.Tag{71, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("71.2.key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2171),
}),
}),
- pack.Tag{73, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("73.1.key"),
- pack.Tag{2, pack.VarintType}, pack.Varint(int(testpb.TestAllTypes_FOO)),
+ protopack.Tag{73, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("73.1.key"),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(int(testpb.TestAllTypes_FOO)),
}),
- pack.Tag{73, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("73.2.key"),
- pack.Tag{2, pack.VarintType}, pack.Varint(int(testpb.TestAllTypes_BAR)),
+ protopack.Tag{73, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("73.2.key"),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(int(testpb.TestAllTypes_BAR)),
}),
}.Marshal(),
},
@@ -752,16 +752,16 @@
"71.1.key": {"a": 1171},
},
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{56, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.VarintType}, pack.Varint(1156),
- pack.Tag{1, pack.VarintType}, pack.Varint(1056),
+ wire: protopack.Message{
+ protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1156),
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1056),
}),
- pack.Tag{71, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1171),
+ protopack.Tag{71, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1171),
}),
- pack.Tag{1, pack.BytesType}, pack.String("71.1.key"),
+ protopack.Tag{1, protopack.BytesType}, protopack.String("71.1.key"),
}),
}.Marshal(),
},
@@ -773,19 +773,19 @@
"71.1.key": {"a": 1171},
},
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{56, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(0),
- pack.Tag{2, pack.VarintType}, pack.Varint(0),
- pack.Tag{1, pack.VarintType}, pack.Varint(1056),
- pack.Tag{2, pack.VarintType}, pack.Varint(1156),
+ wire: protopack.Message{
+ protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1056),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1156),
}),
- pack.Tag{71, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String(0),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{1, pack.BytesType}, pack.String("71.1.key"),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1171),
+ protopack.Tag{71, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String(0),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{1, protopack.BytesType}, protopack.String("71.1.key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1171),
}),
}),
}.Marshal(),
@@ -795,7 +795,7 @@
decodeTo: makeMessages(protobuild.Message{
"oneof_uint32": 1111,
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{111, pack.VarintType}, pack.Varint(1111)}.Marshal(),
+ wire: protopack.Message{protopack.Tag{111, protopack.VarintType}, protopack.Varint(1111)}.Marshal(),
},
{
desc: "oneof (message)",
@@ -804,8 +804,8 @@
"a": 1112,
},
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{112, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Message{pack.Tag{1, pack.VarintType}, pack.Varint(1112)},
+ wire: protopack.Message{protopack.Tag{112, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Message{protopack.Tag{1, protopack.VarintType}, protopack.Varint(1112)},
})}.Marshal(),
},
{
@@ -813,7 +813,7 @@
decodeTo: makeMessages(protobuild.Message{
"oneof_nested_message": protobuild.Message{},
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{112, pack.BytesType}, pack.LengthPrefix(pack.Message{})}.Marshal(),
+ wire: protopack.Message{protopack.Tag{112, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{})}.Marshal(),
},
{
desc: "oneof (merged message)",
@@ -825,13 +825,13 @@
},
},
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{112, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Message{pack.Tag{1, pack.VarintType}, pack.Varint(1)},
+ wire: protopack.Message{
+ protopack.Tag{112, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Message{protopack.Tag{1, protopack.VarintType}, protopack.Varint(1)},
}),
- pack.Tag{112, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(43),
+ protopack.Tag{112, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(43),
}),
}),
}.Marshal(),
@@ -843,10 +843,10 @@
"a": 1,
},
}, &testpb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{121, pack.StartGroupType},
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
- pack.Tag{121, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{121, protopack.StartGroupType},
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{121, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -854,9 +854,9 @@
decodeTo: makeMessages(protobuild.Message{
"oneofgroup": protobuild.Message{},
}, &testpb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{121, pack.StartGroupType},
- pack.Tag{121, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{121, protopack.StartGroupType},
+ protopack.Tag{121, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -867,13 +867,13 @@
"b": 2,
},
}, &testpb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{121, pack.StartGroupType},
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
- pack.Tag{121, pack.EndGroupType},
- pack.Tag{121, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(2),
- pack.Tag{121, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{121, protopack.StartGroupType},
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{121, protopack.EndGroupType},
+ protopack.Tag{121, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(2),
+ protopack.Tag{121, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -881,65 +881,65 @@
decodeTo: makeMessages(protobuild.Message{
"oneof_string": "1113",
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{113, pack.BytesType}, pack.String("1113")}.Marshal(),
+ wire: protopack.Message{protopack.Tag{113, protopack.BytesType}, protopack.String("1113")}.Marshal(),
},
{
desc: "oneof (bytes)",
decodeTo: makeMessages(protobuild.Message{
"oneof_bytes": "1114",
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{114, pack.BytesType}, pack.String("1114")}.Marshal(),
+ wire: protopack.Message{protopack.Tag{114, protopack.BytesType}, protopack.String("1114")}.Marshal(),
},
{
desc: "oneof (bool)",
decodeTo: makeMessages(protobuild.Message{
"oneof_bool": true,
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{115, pack.VarintType}, pack.Bool(true)}.Marshal(),
+ wire: protopack.Message{protopack.Tag{115, protopack.VarintType}, protopack.Bool(true)}.Marshal(),
},
{
desc: "oneof (uint64)",
decodeTo: makeMessages(protobuild.Message{
"oneof_uint64": 116,
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{116, pack.VarintType}, pack.Varint(116)}.Marshal(),
+ wire: protopack.Message{protopack.Tag{116, protopack.VarintType}, protopack.Varint(116)}.Marshal(),
},
{
desc: "oneof (float)",
decodeTo: makeMessages(protobuild.Message{
"oneof_float": 117.5,
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{117, pack.Fixed32Type}, pack.Float32(117.5)}.Marshal(),
+ wire: protopack.Message{protopack.Tag{117, protopack.Fixed32Type}, protopack.Float32(117.5)}.Marshal(),
},
{
desc: "oneof (double)",
decodeTo: makeMessages(protobuild.Message{
"oneof_double": 118.5,
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{118, pack.Fixed64Type}, pack.Float64(118.5)}.Marshal(),
+ wire: protopack.Message{protopack.Tag{118, protopack.Fixed64Type}, protopack.Float64(118.5)}.Marshal(),
},
{
desc: "oneof (enum)",
decodeTo: makeMessages(protobuild.Message{
"oneof_enum": "BAR",
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{119, pack.VarintType}, pack.Varint(int(testpb.TestAllTypes_BAR))}.Marshal(),
+ wire: protopack.Message{protopack.Tag{119, protopack.VarintType}, protopack.Varint(int(testpb.TestAllTypes_BAR))}.Marshal(),
},
{
desc: "oneof (zero)",
decodeTo: makeMessages(protobuild.Message{
"oneof_uint64": 0,
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{116, pack.VarintType}, pack.Varint(0)}.Marshal(),
+ wire: protopack.Message{protopack.Tag{116, protopack.VarintType}, protopack.Varint(0)}.Marshal(),
},
{
desc: "oneof (overridden value)",
decodeTo: makeMessages(protobuild.Message{
"oneof_uint64": 2,
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{111, pack.VarintType}, pack.Varint(1),
- pack.Tag{116, pack.VarintType}, pack.Varint(2),
+ wire: protopack.Message{
+ protopack.Tag{111, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{116, protopack.VarintType}, protopack.Varint(2),
}.Marshal(),
},
// TODO: More unknown field tests for ordering, repeated fields, etc.
@@ -951,12 +951,12 @@
desc: "unknown fields",
checkFastInit: true,
decodeTo: makeMessages(protobuild.Message{
- protobuild.Unknown: pack.Message{
- pack.Tag{100000, pack.VarintType}, pack.Varint(1),
+ protobuild.Unknown: protopack.Message{
+ protopack.Tag{100000, protopack.VarintType}, protopack.Varint(1),
}.Marshal(),
}),
- wire: pack.Message{
- pack.Tag{100000, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{100000, protopack.VarintType}, protopack.Varint(1),
}.Marshal(),
},
{
@@ -965,19 +965,19 @@
DiscardUnknown: true,
},
decodeTo: makeMessages(protobuild.Message{}),
- wire: pack.Message{
- pack.Tag{100000, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{100000, protopack.VarintType}, protopack.Varint(1),
}.Marshal(),
},
{
desc: "field type mismatch",
decodeTo: makeMessages(protobuild.Message{
- protobuild.Unknown: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("string"),
+ protobuild.Unknown: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("string"),
}.Marshal(),
}),
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("string"),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("string"),
}.Marshal(),
},
{
@@ -985,10 +985,10 @@
decodeTo: makeMessages(protobuild.Message{
"map_int32_int32": map[int32]int32{1: 0},
}, &testpb.TestAllTypes{}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{56, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
- pack.Tag{2, pack.BytesType}, pack.String("string"),
+ wire: protopack.Message{
+ protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{2, protopack.BytesType}, protopack.String("string"),
}),
}.Marshal(),
},
@@ -1010,8 +1010,8 @@
decodeTo: makeMessages(protobuild.Message{
"v": 1,
}, &requiredpb.Int32{}),
- wire: pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}.Marshal(),
},
{
@@ -1026,8 +1026,8 @@
decodeTo: makeMessages(protobuild.Message{
"v": 1,
}, &requiredpb.Fixed32{}),
- wire: pack.Message{
- pack.Tag{1, pack.Fixed32Type}, pack.Int32(1),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.Fixed32Type}, protopack.Int32(1),
}.Marshal(),
},
{
@@ -1042,8 +1042,8 @@
decodeTo: makeMessages(protobuild.Message{
"v": 1,
}, &requiredpb.Fixed64{}),
- wire: pack.Message{
- pack.Tag{1, pack.Fixed64Type}, pack.Int64(1),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.Fixed64Type}, protopack.Int64(1),
}.Marshal(),
},
{
@@ -1058,8 +1058,8 @@
decodeTo: makeMessages(protobuild.Message{
"v": "",
}, &requiredpb.Bytes{}),
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.Bytes(nil),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.Bytes(nil),
}.Marshal(),
},
{
@@ -1074,8 +1074,8 @@
decodeTo: makeMessages(protobuild.Message{
"v": protobuild.Message{},
}, &requiredpb.Message{}),
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
}.Marshal(),
},
{
@@ -1090,9 +1090,9 @@
decodeTo: makeMessages(protobuild.Message{
"group": protobuild.Message{},
}, &requiredpb.Group{}),
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -1101,12 +1101,12 @@
partial: true,
decodeTo: []proto.Message{build(
&testpb.TestRequired{},
- unknown(pack.Message{
- pack.Tag{1, pack.Fixed32Type}, pack.Int32(2),
+ unknown(protopack.Message{
+ protopack.Tag{1, protopack.Fixed32Type}, protopack.Int32(2),
}.Marshal()),
)},
- wire: pack.Message{
- pack.Tag{1, pack.Fixed32Type}, pack.Int32(2),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.Fixed32Type}, protopack.Int32(2),
}.Marshal(),
},
{
@@ -1116,8 +1116,8 @@
decodeTo: makeMessages(protobuild.Message{
"optional_message": protobuild.Message{},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
}.Marshal(),
},
{
@@ -1128,9 +1128,9 @@
"required_field": 1,
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
}.Marshal(),
},
@@ -1143,10 +1143,10 @@
"required_field": 1,
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
}.Marshal(),
},
@@ -1160,11 +1160,11 @@
{},
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
}.Marshal(),
},
{
@@ -1176,12 +1176,12 @@
{"required_field": 2},
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
}),
}.Marshal(),
},
@@ -1195,16 +1195,16 @@
2: {},
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
}),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
}),
}.Marshal(),
},
@@ -1217,9 +1217,9 @@
2: {},
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
+ wire: protopack.Message{
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
}),
}.Marshal(),
},
@@ -1232,17 +1232,17 @@
2: {"required_field": 2},
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
}),
- pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
+ protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
}),
}),
}.Marshal(),
@@ -1254,9 +1254,9 @@
decodeTo: makeMessages(protobuild.Message{
"optionalgroup": protobuild.Message{},
}, &testpb.TestRequiredGroupFields{}),
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -1267,10 +1267,10 @@
"a": 1,
},
}, &testpb.TestRequiredGroupFields{}),
- wire: pack.Message{
- pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(1),
- pack.Tag{1, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.StartGroupType},
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{1, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -1283,12 +1283,12 @@
{},
},
}, &testpb.TestRequiredGroupFields{}),
- wire: pack.Message{
- pack.Tag{3, pack.StartGroupType},
- pack.Tag{4, pack.VarintType}, pack.Varint(1),
- pack.Tag{3, pack.EndGroupType},
- pack.Tag{3, pack.StartGroupType},
- pack.Tag{3, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{3, protopack.StartGroupType},
+ protopack.Tag{4, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{3, protopack.EndGroupType},
+ protopack.Tag{3, protopack.StartGroupType},
+ protopack.Tag{3, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -1300,13 +1300,13 @@
{"a": 2},
},
}, &testpb.TestRequiredGroupFields{}),
- wire: pack.Message{
- pack.Tag{3, pack.StartGroupType},
- pack.Tag{4, pack.VarintType}, pack.Varint(1),
- pack.Tag{3, pack.EndGroupType},
- pack.Tag{3, pack.StartGroupType},
- pack.Tag{4, pack.VarintType}, pack.Varint(2),
- pack.Tag{3, pack.EndGroupType},
+ wire: protopack.Message{
+ protopack.Tag{3, protopack.StartGroupType},
+ protopack.Tag{4, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{3, protopack.EndGroupType},
+ protopack.Tag{3, protopack.StartGroupType},
+ protopack.Tag{4, protopack.VarintType}, protopack.Varint(2),
+ protopack.Tag{3, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -1316,7 +1316,7 @@
decodeTo: makeMessages(protobuild.Message{
"oneof_message": protobuild.Message{},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{pack.Tag{4, pack.BytesType}, pack.LengthPrefix(pack.Message{})}.Marshal(),
+ wire: protopack.Message{protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{})}.Marshal(),
},
{
desc: "required field in oneof message set",
@@ -1326,8 +1326,8 @@
"required_field": 1,
},
}, &testpb.TestRequiredForeign{}),
- wire: pack.Message{pack.Tag{4, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
})}.Marshal(),
},
{
@@ -1337,8 +1337,8 @@
decodeTo: makeMessages(protobuild.Message{
"single": protobuild.Message{},
}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{1000, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
+ wire: protopack.Message{
+ protopack.Tag{1000, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
}.Marshal(),
},
{
@@ -1349,9 +1349,9 @@
"required_field": 1,
},
}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{1000, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{1000, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
}.Marshal(),
},
@@ -1365,11 +1365,11 @@
{},
},
}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{1001, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{1001, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{1001, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
+ protopack.Tag{1001, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{}),
}.Marshal(),
},
{
@@ -1381,12 +1381,12 @@
{"required_field": 2},
},
}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{1001, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
+ wire: protopack.Message{
+ protopack.Tag{1001, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
}),
- pack.Tag{1001, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2),
+ protopack.Tag{1001, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2),
}),
}.Marshal(),
},
@@ -1425,30 +1425,30 @@
},
},
}, &legacypb.Legacy{}),
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{101, pack.VarintType}, pack.Varint(1),
- pack.Tag{115, pack.VarintType}, pack.Varint(0),
- pack.Tag{116, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("x"),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{101, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{115, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{116, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("x"),
}),
- pack.Tag{120, pack.StartGroupType},
- pack.Tag{1, pack.BytesType}, pack.String("x"),
- pack.Tag{120, pack.EndGroupType},
- pack.Tag{516, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("x"),
+ protopack.Tag{120, protopack.StartGroupType},
+ protopack.Tag{1, protopack.BytesType}, protopack.String("x"),
+ protopack.Tag{120, protopack.EndGroupType},
+ protopack.Tag{516, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("x"),
}),
- pack.Tag{520, pack.StartGroupType},
- pack.Tag{1, pack.BytesType}, pack.String("x"),
- pack.Tag{520, pack.EndGroupType},
- pack.Tag{616, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("x"),
+ protopack.Tag{520, protopack.StartGroupType},
+ protopack.Tag{1, protopack.BytesType}, protopack.String("x"),
+ protopack.Tag{520, protopack.EndGroupType},
+ protopack.Tag{616, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("x"),
}),
}),
- pack.Tag{716, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("x"),
+ protopack.Tag{716, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("x"),
}),
}),
}.Marshal(),
@@ -1457,23 +1457,23 @@
{
desc: "first reserved field number",
decodeTo: makeMessages(protobuild.Message{
- protobuild.Unknown: pack.Message{
- pack.Tag{pack.FirstReservedNumber, pack.VarintType}, pack.Varint(1004),
+ protobuild.Unknown: protopack.Message{
+ protopack.Tag{protopack.FirstReservedNumber, protopack.VarintType}, protopack.Varint(1004),
}.Marshal(),
}),
- wire: pack.Message{
- pack.Tag{pack.FirstReservedNumber, pack.VarintType}, pack.Varint(1004),
+ wire: protopack.Message{
+ protopack.Tag{protopack.FirstReservedNumber, protopack.VarintType}, protopack.Varint(1004),
}.Marshal(),
},
{
desc: "last reserved field number",
decodeTo: makeMessages(protobuild.Message{
- protobuild.Unknown: pack.Message{
- pack.Tag{pack.LastReservedNumber, pack.VarintType}, pack.Varint(1005),
+ protobuild.Unknown: protopack.Message{
+ protopack.Tag{protopack.LastReservedNumber, protopack.VarintType}, protopack.Varint(1005),
}.Marshal(),
}),
- wire: pack.Message{
- pack.Tag{pack.LastReservedNumber, pack.VarintType}, pack.Varint(1005),
+ wire: protopack.Message{
+ protopack.Tag{protopack.LastReservedNumber, protopack.VarintType}, protopack.Varint(1005),
}.Marshal(),
},
{
@@ -1503,13 +1503,13 @@
},
},
}, &testpb.TestAllExtensions{}),
- wire: pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(42),
- pack.Tag{2, pack.VarintType}, pack.Varint(43),
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(42),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(43),
}),
}),
}),
@@ -1524,8 +1524,8 @@
decodeTo: makeMessages(protobuild.Message{
"optional_string": "abc\xff",
}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{14, pack.BytesType}, pack.String("abc\xff"),
+ wire: protopack.Message{
+ protopack.Tag{14, protopack.BytesType}, protopack.String("abc\xff"),
}.Marshal(),
},
{
@@ -1533,9 +1533,9 @@
decodeTo: makeMessages(protobuild.Message{
"repeated_string": []string{"foo", "abc\xff"},
}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{44, pack.BytesType}, pack.String("foo"),
- pack.Tag{44, pack.BytesType}, pack.String("abc\xff"),
+ wire: protopack.Message{
+ protopack.Tag{44, protopack.BytesType}, protopack.String("foo"),
+ protopack.Tag{44, protopack.BytesType}, protopack.String("abc\xff"),
}.Marshal(),
},
{
@@ -1547,10 +1547,10 @@
},
},
}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{14, pack.BytesType}, pack.String("abc\xff"),
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{14, protopack.BytesType}, protopack.String("abc\xff"),
}),
}),
}.Marshal(),
@@ -1560,17 +1560,17 @@
decodeTo: makeMessages(protobuild.Message{
"oneof_string": "abc\xff",
}, &test3pb.TestAllTypes{}),
- wire: pack.Message{pack.Tag{113, pack.BytesType}, pack.String("abc\xff")}.Marshal(),
+ wire: protopack.Message{protopack.Tag{113, protopack.BytesType}, protopack.String("abc\xff")}.Marshal(),
},
{
desc: "invalid UTF-8 in map key",
decodeTo: makeMessages(protobuild.Message{
"map_string_string": map[string]string{"key\xff": "val"},
}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{69, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("key\xff"),
- pack.Tag{2, pack.BytesType}, pack.String("val"),
+ wire: protopack.Message{
+ protopack.Tag{69, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("key\xff"),
+ protopack.Tag{2, protopack.BytesType}, protopack.String("val"),
}),
}.Marshal(),
},
@@ -1579,10 +1579,10 @@
decodeTo: makeMessages(protobuild.Message{
"map_string_string": map[string]string{"key": "val\xff"},
}, &test3pb.TestAllTypes{}),
- wire: pack.Message{
- pack.Tag{69, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("key"),
- pack.Tag{2, pack.BytesType}, pack.String("val\xff"),
+ wire: protopack.Message{
+ protopack.Tag{69, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("key"),
+ protopack.Tag{2, protopack.BytesType}, protopack.String("val\xff"),
}),
}.Marshal(),
},
@@ -1592,8 +1592,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{pack.MinValidNumber - 1, pack.VarintType}, pack.Varint(1001),
+ wire: protopack.Message{
+ protopack.Tag{protopack.MinValidNumber - 1, protopack.VarintType}, protopack.Varint(1001),
}.Marshal(),
},
{
@@ -1602,9 +1602,9 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{pack.MinValidNumber - 1, pack.VarintType}, pack.Varint(1002),
- pack.Tag{pack.MinValidNumber, pack.VarintType}, pack.Varint(1003),
+ wire: protopack.Message{
+ protopack.Tag{protopack.MinValidNumber - 1, protopack.VarintType}, protopack.Varint(1002),
+ protopack.Tag{protopack.MinValidNumber, protopack.VarintType}, protopack.Varint(1003),
}.Marshal(),
},
{
@@ -1613,9 +1613,9 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{pack.MaxValidNumber, pack.VarintType}, pack.Varint(1006),
- pack.Tag{pack.MaxValidNumber + 1, pack.VarintType}, pack.Varint(1007),
+ wire: protopack.Message{
+ protopack.Tag{protopack.MaxValidNumber, protopack.VarintType}, protopack.Varint(1006),
+ protopack.Tag{protopack.MaxValidNumber + 1, protopack.VarintType}, protopack.Varint(1007),
}.Marshal(),
},
{
@@ -1624,8 +1624,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{pack.MaxValidNumber + 1, pack.VarintType}, pack.Varint(1008),
+ wire: protopack.Message{
+ protopack.Tag{protopack.MaxValidNumber + 1, protopack.VarintType}, protopack.Varint(1008),
}.Marshal(),
},
{
@@ -1634,18 +1634,18 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Varint(2234993595104), pack.Varint(0),
+ wire: protopack.Message{
+ protopack.Varint(2234993595104), protopack.Varint(0),
}.Marshal(),
},
{
desc: "invalid field number in map",
decodeTo: []proto.Message{(*testpb.TestAllTypes)(nil)},
- wire: pack.Message{
- pack.Tag{56, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1056),
- pack.Tag{2, pack.VarintType}, pack.Varint(1156),
- pack.Tag{pack.MaxValidNumber + 1, pack.VarintType}, pack.Varint(0),
+ wire: protopack.Message{
+ protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1056),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(1156),
+ protopack.Tag{protopack.MaxValidNumber + 1, protopack.VarintType}, protopack.Varint(0),
}),
}.Marshal(),
},
@@ -1663,8 +1663,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{0, pack.VarintType}, pack.Varint(0),
+ wire: protopack.Message{
+ protopack.Tag{0, protopack.VarintType}, protopack.Varint(0),
}.Marshal(),
},
{
@@ -1673,8 +1673,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{protowire.MaxValidNumber + 1, pack.VarintType}, pack.Varint(0),
+ wire: protopack.Message{
+ protopack.Tag{protowire.MaxValidNumber + 1, protopack.VarintType}, protopack.Varint(0),
}.Marshal(),
},
{
@@ -1683,9 +1683,9 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Raw{0xff},
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Raw{0xff},
}),
}.Marshal(),
},
@@ -1695,9 +1695,9 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{48, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Raw{0xff},
+ wire: protopack.Message{
+ protopack.Tag{48, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Raw{0xff},
}),
}.Marshal(),
},
@@ -1707,12 +1707,12 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{16, pack.StartGroupType},
- pack.Tag{1000, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Raw{0xff},
+ wire: protopack.Message{
+ protopack.Tag{16, protopack.StartGroupType},
+ protopack.Tag{1000, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Raw{0xff},
}),
- pack.Tag{16, pack.EndGroupType},
+ protopack.Tag{16, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -1721,12 +1721,12 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{46, pack.StartGroupType},
- pack.Tag{1001, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Raw{0xff},
+ wire: protopack.Message{
+ protopack.Tag{46, protopack.StartGroupType},
+ protopack.Tag{1001, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Raw{0xff},
}),
- pack.Tag{46, pack.EndGroupType},
+ protopack.Tag{46, protopack.EndGroupType},
}.Marshal(),
},
{
@@ -1735,8 +1735,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{46, pack.StartGroupType},
+ wire: protopack.Message{
+ protopack.Tag{46, protopack.StartGroupType},
}.Marshal(),
},
{
@@ -1744,11 +1744,11 @@
decodeTo: []proto.Message{
(*testpb.TestAllTypes)(nil),
},
- wire: pack.Message{
- pack.Tag{56, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(0),
- pack.Tag{2, pack.VarintType}, pack.Varint(0),
- pack.Raw{0xff},
+ wire: protopack.Message{
+ protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{2, protopack.VarintType}, protopack.Varint(0),
+ protopack.Raw{0xff},
}),
}.Marshal(),
},
@@ -1757,11 +1757,11 @@
decodeTo: []proto.Message{
(*testpb.TestAllTypes)(nil),
},
- wire: pack.Message{
- pack.Tag{71, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(0),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Raw{0xff},
+ wire: protopack.Message{
+ protopack.Tag{71, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(0),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Raw{0xff},
}),
}),
}.Marshal(),
@@ -1772,8 +1772,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{31, pack.BytesType}, pack.Bytes{0xff},
+ wire: protopack.Message{
+ protopack.Tag{31, protopack.BytesType}, protopack.Bytes{0xff},
}.Marshal(),
},
{
@@ -1782,8 +1782,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{32, pack.BytesType}, pack.Bytes{0xff},
+ wire: protopack.Message{
+ protopack.Tag{32, protopack.BytesType}, protopack.Bytes{0xff},
}.Marshal(),
},
{
@@ -1792,8 +1792,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{33, pack.BytesType}, pack.Bytes{0xff},
+ wire: protopack.Message{
+ protopack.Tag{33, protopack.BytesType}, protopack.Bytes{0xff},
}.Marshal(),
},
{
@@ -1802,8 +1802,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{34, pack.BytesType}, pack.Bytes{0xff},
+ wire: protopack.Message{
+ protopack.Tag{34, protopack.BytesType}, protopack.Bytes{0xff},
}.Marshal(),
},
{
@@ -1812,8 +1812,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{35, pack.BytesType}, pack.Bytes{0xff},
+ wire: protopack.Message{
+ protopack.Tag{35, protopack.BytesType}, protopack.Bytes{0xff},
}.Marshal(),
},
{
@@ -1822,8 +1822,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{36, pack.BytesType}, pack.Bytes{0xff},
+ wire: protopack.Message{
+ protopack.Tag{36, protopack.BytesType}, protopack.Bytes{0xff},
}.Marshal(),
},
{
@@ -1832,8 +1832,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{37, pack.BytesType}, pack.Bytes{0x00},
+ wire: protopack.Message{
+ protopack.Tag{37, protopack.BytesType}, protopack.Bytes{0x00},
}.Marshal(),
},
{
@@ -1842,8 +1842,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{38, pack.BytesType}, pack.Bytes{0x00},
+ wire: protopack.Message{
+ protopack.Tag{38, protopack.BytesType}, protopack.Bytes{0x00},
}.Marshal(),
},
{
@@ -1852,8 +1852,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{39, pack.BytesType}, pack.Bytes{0x00},
+ wire: protopack.Message{
+ protopack.Tag{39, protopack.BytesType}, protopack.Bytes{0x00},
}.Marshal(),
},
{
@@ -1862,8 +1862,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{40, pack.BytesType}, pack.Bytes{0x00},
+ wire: protopack.Message{
+ protopack.Tag{40, protopack.BytesType}, protopack.Bytes{0x00},
}.Marshal(),
},
{
@@ -1872,8 +1872,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{41, pack.BytesType}, pack.Bytes{0x00},
+ wire: protopack.Message{
+ protopack.Tag{41, protopack.BytesType}, protopack.Bytes{0x00},
}.Marshal(),
},
{
@@ -1882,8 +1882,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{42, pack.BytesType}, pack.Bytes{0x00},
+ wire: protopack.Message{
+ protopack.Tag{42, protopack.BytesType}, protopack.Bytes{0x00},
}.Marshal(),
},
{
@@ -1892,8 +1892,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{43, pack.BytesType}, pack.Bytes{0xff},
+ wire: protopack.Message{
+ protopack.Tag{43, protopack.BytesType}, protopack.Bytes{0xff},
}.Marshal(),
},
{
@@ -1902,12 +1902,12 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{18, pack.BytesType}, pack.LengthPrefix{pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix{pack.Message{
- pack.Tag{15, pack.BytesType}, pack.Varint(2),
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType}, protopack.LengthPrefix{protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix{protopack.Message{
+ protopack.Tag{15, protopack.BytesType}, protopack.Varint(2),
}},
- pack.Tag{1, pack.VarintType}, pack.Varint(0),
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(0),
}},
}.Marshal(),
},
@@ -1917,8 +1917,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{1, pack.VarintType},
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.VarintType},
}.Marshal(),
},
{
@@ -1927,8 +1927,8 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{18, pack.BytesType},
+ wire: protopack.Message{
+ protopack.Tag{18, protopack.BytesType},
}.Marshal(),
},
{
@@ -1937,9 +1937,9 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{1, pack.VarintType},
- pack.Raw("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02"),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.VarintType},
+ protopack.Raw("\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02"),
}.Marshal(),
},
{
@@ -1948,9 +1948,9 @@
(*testpb.TestAllTypes)(nil),
(*testpb.TestAllExtensions)(nil),
},
- wire: pack.Message{
- pack.Tag{1, pack.VarintType},
- pack.Raw("\xff\xff\xff\xff\xff\xff\xff\xff\xff"),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.VarintType},
+ protopack.Raw("\xff\xff\xff\xff\xff\xff\xff\xff\xff"),
}.Marshal(),
},
}
diff --git a/proto/weak_test.go b/proto/weak_test.go
index bbb1c8d..79340e3 100644
--- a/proto/weak_test.go
+++ b/proto/weak_test.go
@@ -7,10 +7,10 @@
import (
"testing"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/internal/protobuild"
"google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/testing/protopack"
testpb "google.golang.org/protobuf/internal/testprotos/test"
weakpb "google.golang.org/protobuf/internal/testprotos/test/weak1"
@@ -36,20 +36,20 @@
m.SetWeakMessage1(&weakpb.WeakImportMessage1{
A: proto.Int32(1000),
})
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2000),
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2000),
}),
}.Marshal())
return m
}(),
},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(1000),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(1000),
}),
- pack.Tag{2, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Varint(2000),
+ protopack.Tag{2, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Varint(2000),
}),
}.Marshal(),
},
@@ -59,9 +59,9 @@
{
desc: "invalid field number 0 in weak message",
decodeTo: []proto.Message{(*testpb.TestWeak)(nil)},
- wire: pack.Message{
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{0, pack.VarintType}, pack.Varint(1000),
+ wire: protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{0, protopack.VarintType}, protopack.Varint(1000),
}),
}.Marshal(),
},
diff --git a/testing/protocmp/util_test.go b/testing/protocmp/util_test.go
index 728dcc7..ed386e4 100644
--- a/testing/protocmp/util_test.go
+++ b/testing/protocmp/util_test.go
@@ -12,9 +12,9 @@
"github.com/google/go-cmp/cmp"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
+ "google.golang.org/protobuf/testing/protopack"
"google.golang.org/protobuf/types/dynamicpb"
testpb "google.golang.org/protobuf/internal/testprotos/test"
@@ -208,8 +208,8 @@
}}...)
// Test IgnoreUnknown.
- raw := pack.Message{
- pack.Tag{1, pack.BytesType}, pack.String("Hello, goodbye!"),
+ raw := protopack.Message{
+ protopack.Tag{1, protopack.BytesType}, protopack.String("Hello, goodbye!"),
}.Marshal()
tests = append(tests, []test{{
x: apply(&testpb.TestAllTypes{OptionalSint64: proto.Int64(5)}, setUnknown{raw}),
diff --git a/testing/protocmp/xform_test.go b/testing/protocmp/xform_test.go
index a5b15ee..da6550b 100644
--- a/testing/protocmp/xform_test.go
+++ b/testing/protocmp/xform_test.go
@@ -10,9 +10,9 @@
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/internal/detrand"
- "google.golang.org/protobuf/internal/encoding/pack"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
+ "google.golang.org/protobuf/testing/protopack"
testpb "google.golang.org/protobuf/internal/testprotos/test"
)
@@ -210,51 +210,51 @@
}, {
in: func() proto.Message {
m := &testpb.TestAllTypes{}
- m.ProtoReflect().SetUnknown(pack.Message{
- pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Uvarint(100),
- pack.Tag{Number: 50001, Type: pack.Fixed32Type}, pack.Uint32(200),
- pack.Tag{Number: 50002, Type: pack.Fixed64Type}, pack.Uint64(300),
- pack.Tag{Number: 50003, Type: pack.BytesType}, pack.String("hello"),
- pack.Message{
- pack.Tag{Number: 50004, Type: pack.StartGroupType},
- pack.Tag{Number: 1, Type: pack.VarintType}, pack.Uvarint(100),
- pack.Tag{Number: 1, Type: pack.Fixed32Type}, pack.Uint32(200),
- pack.Tag{Number: 1, Type: pack.Fixed64Type}, pack.Uint64(300),
- pack.Tag{Number: 1, Type: pack.BytesType}, pack.String("hello"),
- pack.Message{
- pack.Tag{Number: 1, Type: pack.StartGroupType},
- pack.Tag{Number: 1, Type: pack.VarintType}, pack.Uvarint(100),
- pack.Tag{Number: 1, Type: pack.Fixed32Type}, pack.Uint32(200),
- pack.Tag{Number: 1, Type: pack.Fixed64Type}, pack.Uint64(300),
- pack.Tag{Number: 1, Type: pack.BytesType}, pack.String("hello"),
- pack.Tag{Number: 1, Type: pack.EndGroupType},
+ m.ProtoReflect().SetUnknown(protopack.Message{
+ protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Uvarint(100),
+ protopack.Tag{Number: 50001, Type: protopack.Fixed32Type}, protopack.Uint32(200),
+ protopack.Tag{Number: 50002, Type: protopack.Fixed64Type}, protopack.Uint64(300),
+ protopack.Tag{Number: 50003, Type: protopack.BytesType}, protopack.String("hello"),
+ protopack.Message{
+ protopack.Tag{Number: 50004, Type: protopack.StartGroupType},
+ protopack.Tag{Number: 1, Type: protopack.VarintType}, protopack.Uvarint(100),
+ protopack.Tag{Number: 1, Type: protopack.Fixed32Type}, protopack.Uint32(200),
+ protopack.Tag{Number: 1, Type: protopack.Fixed64Type}, protopack.Uint64(300),
+ protopack.Tag{Number: 1, Type: protopack.BytesType}, protopack.String("hello"),
+ protopack.Message{
+ protopack.Tag{Number: 1, Type: protopack.StartGroupType},
+ protopack.Tag{Number: 1, Type: protopack.VarintType}, protopack.Uvarint(100),
+ protopack.Tag{Number: 1, Type: protopack.Fixed32Type}, protopack.Uint32(200),
+ protopack.Tag{Number: 1, Type: protopack.Fixed64Type}, protopack.Uint64(300),
+ protopack.Tag{Number: 1, Type: protopack.BytesType}, protopack.String("hello"),
+ protopack.Tag{Number: 1, Type: protopack.EndGroupType},
},
- pack.Tag{Number: 50004, Type: pack.EndGroupType},
+ protopack.Tag{Number: 50004, Type: protopack.EndGroupType},
},
}.Marshal())
return m
}(),
want: Message{
messageTypeKey: messageTypeOf(&testpb.TestAllTypes{}),
- "50000": protoreflect.RawFields(pack.Message{pack.Tag{Number: 50000, Type: pack.VarintType}, pack.Uvarint(100)}.Marshal()),
- "50001": protoreflect.RawFields(pack.Message{pack.Tag{Number: 50001, Type: pack.Fixed32Type}, pack.Uint32(200)}.Marshal()),
- "50002": protoreflect.RawFields(pack.Message{pack.Tag{Number: 50002, Type: pack.Fixed64Type}, pack.Uint64(300)}.Marshal()),
- "50003": protoreflect.RawFields(pack.Message{pack.Tag{Number: 50003, Type: pack.BytesType}, pack.String("hello")}.Marshal()),
- "50004": protoreflect.RawFields(pack.Message{
- pack.Tag{Number: 50004, Type: pack.StartGroupType},
- pack.Tag{Number: 1, Type: pack.VarintType}, pack.Uvarint(100),
- pack.Tag{Number: 1, Type: pack.Fixed32Type}, pack.Uint32(200),
- pack.Tag{Number: 1, Type: pack.Fixed64Type}, pack.Uint64(300),
- pack.Tag{Number: 1, Type: pack.BytesType}, pack.String("hello"),
- pack.Message{
- pack.Tag{Number: 1, Type: pack.StartGroupType},
- pack.Tag{Number: 1, Type: pack.VarintType}, pack.Uvarint(100),
- pack.Tag{Number: 1, Type: pack.Fixed32Type}, pack.Uint32(200),
- pack.Tag{Number: 1, Type: pack.Fixed64Type}, pack.Uint64(300),
- pack.Tag{Number: 1, Type: pack.BytesType}, pack.String("hello"),
- pack.Tag{Number: 1, Type: pack.EndGroupType},
+ "50000": protoreflect.RawFields(protopack.Message{protopack.Tag{Number: 50000, Type: protopack.VarintType}, protopack.Uvarint(100)}.Marshal()),
+ "50001": protoreflect.RawFields(protopack.Message{protopack.Tag{Number: 50001, Type: protopack.Fixed32Type}, protopack.Uint32(200)}.Marshal()),
+ "50002": protoreflect.RawFields(protopack.Message{protopack.Tag{Number: 50002, Type: protopack.Fixed64Type}, protopack.Uint64(300)}.Marshal()),
+ "50003": protoreflect.RawFields(protopack.Message{protopack.Tag{Number: 50003, Type: protopack.BytesType}, protopack.String("hello")}.Marshal()),
+ "50004": protoreflect.RawFields(protopack.Message{
+ protopack.Tag{Number: 50004, Type: protopack.StartGroupType},
+ protopack.Tag{Number: 1, Type: protopack.VarintType}, protopack.Uvarint(100),
+ protopack.Tag{Number: 1, Type: protopack.Fixed32Type}, protopack.Uint32(200),
+ protopack.Tag{Number: 1, Type: protopack.Fixed64Type}, protopack.Uint64(300),
+ protopack.Tag{Number: 1, Type: protopack.BytesType}, protopack.String("hello"),
+ protopack.Message{
+ protopack.Tag{Number: 1, Type: protopack.StartGroupType},
+ protopack.Tag{Number: 1, Type: protopack.VarintType}, protopack.Uvarint(100),
+ protopack.Tag{Number: 1, Type: protopack.Fixed32Type}, protopack.Uint32(200),
+ protopack.Tag{Number: 1, Type: protopack.Fixed64Type}, protopack.Uint64(300),
+ protopack.Tag{Number: 1, Type: protopack.BytesType}, protopack.String("hello"),
+ protopack.Tag{Number: 1, Type: protopack.EndGroupType},
},
- pack.Tag{Number: 50004, Type: pack.EndGroupType},
+ protopack.Tag{Number: 50004, Type: protopack.EndGroupType},
}.Marshal()),
},
wantString: `{50000:100, 50001:200, 50002:300, 50003:"hello", 50004:{1:[100, 200, 300, "hello", {1:[100, 200, 300, "hello"]}]}}`,
diff --git a/internal/encoding/pack/pack.go b/testing/protopack/pack.go
similarity index 97%
rename from internal/encoding/pack/pack.go
rename to testing/protopack/pack.go
index 163002f..060529e 100644
--- a/internal/encoding/pack/pack.go
+++ b/testing/protopack/pack.go
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package pack enables manual encoding and decoding of protobuf wire data.
+// Package protopack enables manual encoding and decoding of protobuf wire data.
//
// This package is intended for use in debugging and/or creation of test data.
// Proper usage of this package requires knowledge of the wire format.
//
// See https://developers.google.com/protocol-buffers/docs/encoding.
-package pack
+package protopack
import (
"fmt"
@@ -25,10 +25,10 @@
"google.golang.org/protobuf/reflect/protoreflect"
)
-// Number is the field number; aliased from the wire package for convenience.
+// Number is the field number; aliased from the protowire package for convenience.
type Number = protowire.Number
-// Number type constants; copied from the wire package for convenience.
+// Number type constants; copied from the protowire package for convenience.
const (
MinValidNumber Number = protowire.MinValidNumber
FirstReservedNumber Number = protowire.FirstReservedNumber
@@ -36,10 +36,10 @@
MaxValidNumber Number = protowire.MaxValidNumber
)
-// Type is the wire type; aliased from the wire package for convenience.
+// Type is the wire type; aliased from the protowire package for convenience.
type Type = protowire.Type
-// Wire type constants; copied from the wire package for convenience.
+// Wire type constants; copied from the protowire package for convenience.
const (
VarintType Type = protowire.VarintType
Fixed32Type Type = protowire.Fixed32Type
diff --git a/internal/encoding/pack/pack_test.go b/testing/protopack/pack_test.go
similarity index 86%
rename from internal/encoding/pack/pack_test.go
rename to testing/protopack/pack_test.go
index 8a3d069..9752549 100644
--- a/internal/encoding/pack/pack_test.go
+++ b/testing/protopack/pack_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package pack
+package protopack
import (
"bytes"
@@ -81,11 +81,11 @@
Tag{1, VarintType}, Denormalized{5, Uvarint(2)},
Tag{1, BytesType}, LengthPrefix{Bool(true), Bool(false), Uvarint(2), Denormalized{5, Uvarint(2)}},
},
- wantOutSource: `pack.Message{
- pack.Tag{1, pack.VarintType}, pack.Bool(false),
- pack.Denormalized{+5, pack.Tag{1, pack.VarintType}}, pack.Uvarint(2),
- pack.Tag{1, pack.VarintType}, pack.Denormalized{+5, pack.Uvarint(2)},
- pack.Tag{1, pack.BytesType}, pack.LengthPrefix{pack.Bool(true), pack.Bool(false), pack.Uvarint(2), pack.Denormalized{+5, pack.Uvarint(2)}},
+ wantOutSource: `protopack.Message{
+ protopack.Tag{1, protopack.VarintType}, protopack.Bool(false),
+ protopack.Denormalized{+5, protopack.Tag{1, protopack.VarintType}}, protopack.Uvarint(2),
+ protopack.Tag{1, protopack.VarintType}, protopack.Denormalized{+5, protopack.Uvarint(2)},
+ protopack.Tag{1, protopack.BytesType}, protopack.LengthPrefix{protopack.Bool(true), protopack.Bool(false), protopack.Uvarint(2), protopack.Denormalized{+5, protopack.Uvarint(2)}},
}`,
}, {
raw: dhex("100010828080808000121980808080808080808001ffffffffffffffff7f828080808000"),
@@ -114,10 +114,10 @@
Tag{4, VarintType}, Denormalized{5, Uvarint(+1)},
Tag{4, BytesType}, LengthPrefix{Uvarint(0), Uvarint(math.MaxUint64), Denormalized{5, Uvarint(+1)}},
},
- wantOutSource: `pack.Message{
- pack.Tag{4, pack.VarintType}, pack.Uvarint(1),
- pack.Tag{4, pack.VarintType}, pack.Denormalized{+5, pack.Uvarint(1)},
- pack.Tag{4, pack.BytesType}, pack.LengthPrefix{pack.Uvarint(0), pack.Uvarint(18446744073709551615), pack.Denormalized{+5, pack.Uvarint(1)}},
+ wantOutSource: `protopack.Message{
+ protopack.Tag{4, protopack.VarintType}, protopack.Uvarint(1),
+ protopack.Tag{4, protopack.VarintType}, protopack.Denormalized{+5, protopack.Uvarint(1)},
+ protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix{protopack.Uvarint(0), protopack.Uvarint(18446744073709551615), protopack.Denormalized{+5, protopack.Uvarint(1)}},
}`,
}, {
raw: dhex("2d010000002a0800000000ffffffff"),
@@ -142,9 +142,9 @@
Tag{7, Fixed32Type}, Float32(math.Pi),
Tag{7, BytesType}, LengthPrefix{Float32(math.SmallestNonzeroFloat32), Float32(math.MaxFloat32), Float32(math.Inf(+1)), Float32(math.Inf(-1))},
},
- wantOutSource: `pack.Message{
- pack.Tag{7, pack.Fixed32Type}, pack.Float32(3.1415927),
- pack.Tag{7, pack.BytesType}, pack.LengthPrefix{pack.Float32(1e-45), pack.Float32(3.4028235e+38), pack.Float32(math.Inf(+1)), pack.Float32(math.Inf(-1))},
+ wantOutSource: `protopack.Message{
+ protopack.Tag{7, protopack.Fixed32Type}, protopack.Float32(3.1415927),
+ protopack.Tag{7, protopack.BytesType}, protopack.LengthPrefix{protopack.Float32(1e-45), protopack.Float32(3.4028235e+38), protopack.Float32(math.Inf(+1)), protopack.Float32(math.Inf(-1))},
}`,
}, {
raw: dhex("41010000000000000042100000000000000000ffffffffffffffff"),
@@ -201,14 +201,14 @@
Tag{100, StartGroupType}, Tag{100, EndGroupType},
}),
},
- wantOutSource: `pack.Message{
- pack.Tag{13, pack.BytesType}, pack.LengthPrefix(pack.Message{
- pack.Tag{100, pack.VarintType}, pack.Uvarint(18446744073709551615),
- pack.Tag{100, pack.Fixed32Type}, pack.Uint32(4294967295),
- pack.Tag{100, pack.Fixed64Type}, pack.Uint64(18446744073709551615),
- pack.Tag{100, pack.BytesType}, pack.Bytes("bytes"),
- pack.Tag{100, pack.StartGroupType},
- pack.Tag{100, pack.EndGroupType},
+ wantOutSource: `protopack.Message{
+ protopack.Tag{13, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
+ protopack.Tag{100, protopack.VarintType}, protopack.Uvarint(18446744073709551615),
+ protopack.Tag{100, protopack.Fixed32Type}, protopack.Uint32(4294967295),
+ protopack.Tag{100, protopack.Fixed64Type}, protopack.Uint64(18446744073709551615),
+ protopack.Tag{100, protopack.BytesType}, protopack.Bytes("bytes"),
+ protopack.Tag{100, protopack.StartGroupType},
+ protopack.Tag{100, protopack.EndGroupType},
}),
}`,
}, {
@@ -269,16 +269,16 @@
func() uint32 { return 0x7fe5d008 }(),
)),
},
- wantOutSource: `pack.Message{
- pack.Tag{7, pack.Fixed32Type}, pack.Float32(math.Float32frombits(0x7fe5d008)),
+ wantOutSource: `protopack.Message{
+ protopack.Tag{7, protopack.Fixed32Type}, protopack.Float32(math.Float32frombits(0x7fe5d008)),
}`,
}, {
raw: dhex("51a8d65110771bf97f"),
msg: Message{
Tag{10, Fixed64Type}, Float64(math.Float64frombits(0x7ff91b771051d6a8)),
},
- wantOutSource: `pack.Message{
- pack.Tag{10, pack.Fixed64Type}, pack.Float64(math.Float64frombits(0x7ff91b771051d6a8)),
+ wantOutSource: `protopack.Message{
+ protopack.Tag{10, protopack.Fixed64Type}, protopack.Float64(math.Float64frombits(0x7ff91b771051d6a8)),
}`,
}, {
raw: dhex("ab2c14481ab3e9a76d937fb4dd5e6c616ef311f62b7fe888785fca5609ffe81c1064e50dd7a9edb408d317e2891c0d54c719446938d41ab0ccf8e61dc28b0ebb"),