encoding/textpb: initial implementation of textproto marshaling
This initial implementation covers marshaling Message without use
of extensions, Any expansion, weak yet.
Change-Id: Ic787939c1d2a4e70e40c3a1654c6e7073052b7d3
Reviewed-on: https://go-review.googlesource.com/c/151677
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/encoding/textpb/testprotos/pb2/test.pb.go b/encoding/textpb/testprotos/pb2/test.pb.go
new file mode 100644
index 0000000..e06f5f3
--- /dev/null
+++ b/encoding/textpb/testprotos/pb2/test.pb.go
@@ -0,0 +1,1319 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: encoding/textpb/testprotos/pb2/test.proto
+
+package pb2
+
+import (
+ fmt "fmt"
+ proto "github.com/golang/protobuf/proto"
+ any "github.com/golang/protobuf/ptypes/any"
+ duration "github.com/golang/protobuf/ptypes/duration"
+ empty "github.com/golang/protobuf/ptypes/empty"
+ _struct "github.com/golang/protobuf/ptypes/struct"
+ timestamp "github.com/golang/protobuf/ptypes/timestamp"
+ wrappers "github.com/golang/protobuf/ptypes/wrappers"
+ math "math"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
+type Enum int32
+
+const (
+ Enum_UNKNOWN Enum = 0
+ Enum_FIRST Enum = 1
+ Enum_SECOND Enum = 2
+ Enum_TENTH Enum = 10
+)
+
+var Enum_name = map[int32]string{
+ 0: "UNKNOWN",
+ 1: "FIRST",
+ 2: "SECOND",
+ 10: "TENTH",
+}
+
+var Enum_value = map[string]int32{
+ "UNKNOWN": 0,
+ "FIRST": 1,
+ "SECOND": 2,
+ "TENTH": 10,
+}
+
+func (x Enum) Enum() *Enum {
+ p := new(Enum)
+ *p = x
+ return p
+}
+
+func (x Enum) String() string {
+ return proto.EnumName(Enum_name, int32(x))
+}
+
+func (x *Enum) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(Enum_value, data, "Enum")
+ if err != nil {
+ return err
+ }
+ *x = Enum(value)
+ return nil
+}
+
+func (Enum) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{0}
+}
+
+type Enums_NestedEnum int32
+
+const (
+ Enums_UNO Enums_NestedEnum = 1
+ Enums_DOS Enums_NestedEnum = 2
+ Enums_DIEZ Enums_NestedEnum = 10
+)
+
+var Enums_NestedEnum_name = map[int32]string{
+ 1: "UNO",
+ 2: "DOS",
+ 10: "DIEZ",
+}
+
+var Enums_NestedEnum_value = map[string]int32{
+ "UNO": 1,
+ "DOS": 2,
+ "DIEZ": 10,
+}
+
+func (x Enums_NestedEnum) Enum() *Enums_NestedEnum {
+ p := new(Enums_NestedEnum)
+ *p = x
+ return p
+}
+
+func (x Enums_NestedEnum) String() string {
+ return proto.EnumName(Enums_NestedEnum_name, int32(x))
+}
+
+func (x *Enums_NestedEnum) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(Enums_NestedEnum_value, data, "Enums_NestedEnum")
+ if err != nil {
+ return err
+ }
+ *x = Enums_NestedEnum(value)
+ return nil
+}
+
+func (Enums_NestedEnum) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{2, 0}
+}
+
+// Scalars contains optional scalar fields.
+type Scalars struct {
+ OptBool *bool `protobuf:"varint,1,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`
+ OptInt32 *int32 `protobuf:"varint,2,opt,name=opt_int32,json=optInt32" json:"opt_int32,omitempty"`
+ OptInt64 *int64 `protobuf:"varint,3,opt,name=opt_int64,json=optInt64" json:"opt_int64,omitempty"`
+ OptUint32 *uint32 `protobuf:"varint,4,opt,name=opt_uint32,json=optUint32" json:"opt_uint32,omitempty"`
+ OptUint64 *uint64 `protobuf:"varint,5,opt,name=opt_uint64,json=optUint64" json:"opt_uint64,omitempty"`
+ OptSint32 *int32 `protobuf:"zigzag32,6,opt,name=opt_sint32,json=optSint32" json:"opt_sint32,omitempty"`
+ OptSint64 *int64 `protobuf:"zigzag64,7,opt,name=opt_sint64,json=optSint64" json:"opt_sint64,omitempty"`
+ OptFixed32 *uint32 `protobuf:"fixed32,8,opt,name=opt_fixed32,json=optFixed32" json:"opt_fixed32,omitempty"`
+ OptFixed64 *uint64 `protobuf:"fixed64,9,opt,name=opt_fixed64,json=optFixed64" json:"opt_fixed64,omitempty"`
+ OptSfixed32 *int32 `protobuf:"fixed32,10,opt,name=opt_sfixed32,json=optSfixed32" json:"opt_sfixed32,omitempty"`
+ OptSfixed64 *int64 `protobuf:"fixed64,11,opt,name=opt_sfixed64,json=optSfixed64" json:"opt_sfixed64,omitempty"`
+ OptFloat *float32 `protobuf:"fixed32,20,opt,name=opt_float,json=optFloat" json:"opt_float,omitempty"`
+ OptDouble *float64 `protobuf:"fixed64,21,opt,name=opt_double,json=optDouble" json:"opt_double,omitempty"`
+ OptBytes []byte `protobuf:"bytes,14,opt,name=opt_bytes,json=optBytes" json:"opt_bytes,omitempty"`
+ OptString *string `protobuf:"bytes,13,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Scalars) Reset() { *m = Scalars{} }
+func (m *Scalars) String() string { return proto.CompactTextString(m) }
+func (*Scalars) ProtoMessage() {}
+func (*Scalars) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{0}
+}
+
+func (m *Scalars) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Scalars.Unmarshal(m, b)
+}
+func (m *Scalars) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Scalars.Marshal(b, m, deterministic)
+}
+func (m *Scalars) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Scalars.Merge(m, src)
+}
+func (m *Scalars) XXX_Size() int {
+ return xxx_messageInfo_Scalars.Size(m)
+}
+func (m *Scalars) XXX_DiscardUnknown() {
+ xxx_messageInfo_Scalars.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Scalars proto.InternalMessageInfo
+
+func (m *Scalars) GetOptBool() bool {
+ if m != nil && m.OptBool != nil {
+ return *m.OptBool
+ }
+ return false
+}
+
+func (m *Scalars) GetOptInt32() int32 {
+ if m != nil && m.OptInt32 != nil {
+ return *m.OptInt32
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptInt64() int64 {
+ if m != nil && m.OptInt64 != nil {
+ return *m.OptInt64
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptUint32() uint32 {
+ if m != nil && m.OptUint32 != nil {
+ return *m.OptUint32
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptUint64() uint64 {
+ if m != nil && m.OptUint64 != nil {
+ return *m.OptUint64
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptSint32() int32 {
+ if m != nil && m.OptSint32 != nil {
+ return *m.OptSint32
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptSint64() int64 {
+ if m != nil && m.OptSint64 != nil {
+ return *m.OptSint64
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptFixed32() uint32 {
+ if m != nil && m.OptFixed32 != nil {
+ return *m.OptFixed32
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptFixed64() uint64 {
+ if m != nil && m.OptFixed64 != nil {
+ return *m.OptFixed64
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptSfixed32() int32 {
+ if m != nil && m.OptSfixed32 != nil {
+ return *m.OptSfixed32
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptSfixed64() int64 {
+ if m != nil && m.OptSfixed64 != nil {
+ return *m.OptSfixed64
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptFloat() float32 {
+ if m != nil && m.OptFloat != nil {
+ return *m.OptFloat
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptDouble() float64 {
+ if m != nil && m.OptDouble != nil {
+ return *m.OptDouble
+ }
+ return 0
+}
+
+func (m *Scalars) GetOptBytes() []byte {
+ if m != nil {
+ return m.OptBytes
+ }
+ return nil
+}
+
+func (m *Scalars) GetOptString() string {
+ if m != nil && m.OptString != nil {
+ return *m.OptString
+ }
+ return ""
+}
+
+// Message contains repeated fields.
+type Repeats struct {
+ RptBool []bool `protobuf:"varint,1,rep,name=rpt_bool,json=rptBool" json:"rpt_bool,omitempty"`
+ RptInt32 []int32 `protobuf:"varint,2,rep,name=rpt_int32,json=rptInt32" json:"rpt_int32,omitempty"`
+ RptInt64 []int64 `protobuf:"varint,3,rep,name=rpt_int64,json=rptInt64" json:"rpt_int64,omitempty"`
+ RptUint32 []uint32 `protobuf:"varint,4,rep,name=rpt_uint32,json=rptUint32" json:"rpt_uint32,omitempty"`
+ RptUint64 []uint64 `protobuf:"varint,5,rep,name=rpt_uint64,json=rptUint64" json:"rpt_uint64,omitempty"`
+ RptFloat []float32 `protobuf:"fixed32,6,rep,name=rpt_float,json=rptFloat" json:"rpt_float,omitempty"`
+ RptDouble []float64 `protobuf:"fixed64,7,rep,name=rpt_double,json=rptDouble" json:"rpt_double,omitempty"`
+ RptString []string `protobuf:"bytes,15,rep,name=rpt_string,json=rptString" json:"rpt_string,omitempty"`
+ RptBytes [][]byte `protobuf:"bytes,14,rep,name=rpt_bytes,json=rptBytes" json:"rpt_bytes,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Repeats) Reset() { *m = Repeats{} }
+func (m *Repeats) String() string { return proto.CompactTextString(m) }
+func (*Repeats) ProtoMessage() {}
+func (*Repeats) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{1}
+}
+
+func (m *Repeats) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Repeats.Unmarshal(m, b)
+}
+func (m *Repeats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Repeats.Marshal(b, m, deterministic)
+}
+func (m *Repeats) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Repeats.Merge(m, src)
+}
+func (m *Repeats) XXX_Size() int {
+ return xxx_messageInfo_Repeats.Size(m)
+}
+func (m *Repeats) XXX_DiscardUnknown() {
+ xxx_messageInfo_Repeats.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Repeats proto.InternalMessageInfo
+
+func (m *Repeats) GetRptBool() []bool {
+ if m != nil {
+ return m.RptBool
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptInt32() []int32 {
+ if m != nil {
+ return m.RptInt32
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptInt64() []int64 {
+ if m != nil {
+ return m.RptInt64
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptUint32() []uint32 {
+ if m != nil {
+ return m.RptUint32
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptUint64() []uint64 {
+ if m != nil {
+ return m.RptUint64
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptFloat() []float32 {
+ if m != nil {
+ return m.RptFloat
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptDouble() []float64 {
+ if m != nil {
+ return m.RptDouble
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptString() []string {
+ if m != nil {
+ return m.RptString
+ }
+ return nil
+}
+
+func (m *Repeats) GetRptBytes() [][]byte {
+ if m != nil {
+ return m.RptBytes
+ }
+ return nil
+}
+
+// Message contains enum fields.
+type Enums struct {
+ OptEnum *Enum `protobuf:"varint,1,opt,name=opt_enum,json=optEnum,enum=pb2.Enum" json:"opt_enum,omitempty"`
+ RptEnum []Enum `protobuf:"varint,2,rep,name=rpt_enum,json=rptEnum,enum=pb2.Enum" json:"rpt_enum,omitempty"`
+ OptNestedEnum *Enums_NestedEnum `protobuf:"varint,3,opt,name=opt_nested_enum,json=optNestedEnum,enum=pb2.Enums_NestedEnum" json:"opt_nested_enum,omitempty"`
+ RptNestedEnum []Enums_NestedEnum `protobuf:"varint,4,rep,name=rpt_nested_enum,json=rptNestedEnum,enum=pb2.Enums_NestedEnum" json:"rpt_nested_enum,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Enums) Reset() { *m = Enums{} }
+func (m *Enums) String() string { return proto.CompactTextString(m) }
+func (*Enums) ProtoMessage() {}
+func (*Enums) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{2}
+}
+
+func (m *Enums) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Enums.Unmarshal(m, b)
+}
+func (m *Enums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Enums.Marshal(b, m, deterministic)
+}
+func (m *Enums) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Enums.Merge(m, src)
+}
+func (m *Enums) XXX_Size() int {
+ return xxx_messageInfo_Enums.Size(m)
+}
+func (m *Enums) XXX_DiscardUnknown() {
+ xxx_messageInfo_Enums.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Enums proto.InternalMessageInfo
+
+func (m *Enums) GetOptEnum() Enum {
+ if m != nil && m.OptEnum != nil {
+ return *m.OptEnum
+ }
+ return Enum_UNKNOWN
+}
+
+func (m *Enums) GetRptEnum() []Enum {
+ if m != nil {
+ return m.RptEnum
+ }
+ return nil
+}
+
+func (m *Enums) GetOptNestedEnum() Enums_NestedEnum {
+ if m != nil && m.OptNestedEnum != nil {
+ return *m.OptNestedEnum
+ }
+ return Enums_UNO
+}
+
+func (m *Enums) GetRptNestedEnum() []Enums_NestedEnum {
+ if m != nil {
+ return m.RptNestedEnum
+ }
+ return nil
+}
+
+// Message contains message and group fields.
+type Nests struct {
+ OptNested *Nested `protobuf:"bytes,1,opt,name=opt_nested,json=optNested" json:"opt_nested,omitempty"`
+ Optgroup *Nests_OptGroup `protobuf:"group,2,opt,name=OptGroup,json=optgroup" json:"optgroup,omitempty"`
+ RptNested []*Nested `protobuf:"bytes,3,rep,name=rpt_nested,json=rptNested" json:"rpt_nested,omitempty"`
+ Rptgroup []*Nests_RptGroup `protobuf:"group,4,rep,name=RptGroup,json=rptgroup" json:"rptgroup,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Nests) Reset() { *m = Nests{} }
+func (m *Nests) String() string { return proto.CompactTextString(m) }
+func (*Nests) ProtoMessage() {}
+func (*Nests) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{3}
+}
+
+func (m *Nests) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Nests.Unmarshal(m, b)
+}
+func (m *Nests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Nests.Marshal(b, m, deterministic)
+}
+func (m *Nests) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Nests.Merge(m, src)
+}
+func (m *Nests) XXX_Size() int {
+ return xxx_messageInfo_Nests.Size(m)
+}
+func (m *Nests) XXX_DiscardUnknown() {
+ xxx_messageInfo_Nests.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Nests proto.InternalMessageInfo
+
+func (m *Nests) GetOptNested() *Nested {
+ if m != nil {
+ return m.OptNested
+ }
+ return nil
+}
+
+func (m *Nests) GetOptgroup() *Nests_OptGroup {
+ if m != nil {
+ return m.Optgroup
+ }
+ return nil
+}
+
+func (m *Nests) GetRptNested() []*Nested {
+ if m != nil {
+ return m.RptNested
+ }
+ return nil
+}
+
+func (m *Nests) GetRptgroup() []*Nests_RptGroup {
+ if m != nil {
+ return m.Rptgroup
+ }
+ return nil
+}
+
+type Nests_OptGroup struct {
+ OptBool *bool `protobuf:"varint,1,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`
+ OptString *string `protobuf:"bytes,2,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
+ OptNested *Nested `protobuf:"bytes,3,opt,name=opt_nested,json=optNested" json:"opt_nested,omitempty"`
+ Optnestedgroup *Nests_OptGroup_OptNestedGroup `protobuf:"group,4,opt,name=OptNestedGroup,json=optnestedgroup" json:"optnestedgroup,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Nests_OptGroup) Reset() { *m = Nests_OptGroup{} }
+func (m *Nests_OptGroup) String() string { return proto.CompactTextString(m) }
+func (*Nests_OptGroup) ProtoMessage() {}
+func (*Nests_OptGroup) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{3, 0}
+}
+
+func (m *Nests_OptGroup) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Nests_OptGroup.Unmarshal(m, b)
+}
+func (m *Nests_OptGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Nests_OptGroup.Marshal(b, m, deterministic)
+}
+func (m *Nests_OptGroup) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Nests_OptGroup.Merge(m, src)
+}
+func (m *Nests_OptGroup) XXX_Size() int {
+ return xxx_messageInfo_Nests_OptGroup.Size(m)
+}
+func (m *Nests_OptGroup) XXX_DiscardUnknown() {
+ xxx_messageInfo_Nests_OptGroup.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Nests_OptGroup proto.InternalMessageInfo
+
+func (m *Nests_OptGroup) GetOptBool() bool {
+ if m != nil && m.OptBool != nil {
+ return *m.OptBool
+ }
+ return false
+}
+
+func (m *Nests_OptGroup) GetOptString() string {
+ if m != nil && m.OptString != nil {
+ return *m.OptString
+ }
+ return ""
+}
+
+func (m *Nests_OptGroup) GetOptNested() *Nested {
+ if m != nil {
+ return m.OptNested
+ }
+ return nil
+}
+
+func (m *Nests_OptGroup) GetOptnestedgroup() *Nests_OptGroup_OptNestedGroup {
+ if m != nil {
+ return m.Optnestedgroup
+ }
+ return nil
+}
+
+type Nests_OptGroup_OptNestedGroup struct {
+ OptEnum *Enum `protobuf:"varint,1,opt,name=opt_enum,json=optEnum,enum=pb2.Enum" json:"opt_enum,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Nests_OptGroup_OptNestedGroup) Reset() { *m = Nests_OptGroup_OptNestedGroup{} }
+func (m *Nests_OptGroup_OptNestedGroup) String() string { return proto.CompactTextString(m) }
+func (*Nests_OptGroup_OptNestedGroup) ProtoMessage() {}
+func (*Nests_OptGroup_OptNestedGroup) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{3, 0, 0}
+}
+
+func (m *Nests_OptGroup_OptNestedGroup) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Nests_OptGroup_OptNestedGroup.Unmarshal(m, b)
+}
+func (m *Nests_OptGroup_OptNestedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Nests_OptGroup_OptNestedGroup.Marshal(b, m, deterministic)
+}
+func (m *Nests_OptGroup_OptNestedGroup) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Nests_OptGroup_OptNestedGroup.Merge(m, src)
+}
+func (m *Nests_OptGroup_OptNestedGroup) XXX_Size() int {
+ return xxx_messageInfo_Nests_OptGroup_OptNestedGroup.Size(m)
+}
+func (m *Nests_OptGroup_OptNestedGroup) XXX_DiscardUnknown() {
+ xxx_messageInfo_Nests_OptGroup_OptNestedGroup.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Nests_OptGroup_OptNestedGroup proto.InternalMessageInfo
+
+func (m *Nests_OptGroup_OptNestedGroup) GetOptEnum() Enum {
+ if m != nil && m.OptEnum != nil {
+ return *m.OptEnum
+ }
+ return Enum_UNKNOWN
+}
+
+type Nests_RptGroup struct {
+ RptBool []bool `protobuf:"varint,1,rep,name=rpt_bool,json=rptBool" json:"rpt_bool,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Nests_RptGroup) Reset() { *m = Nests_RptGroup{} }
+func (m *Nests_RptGroup) String() string { return proto.CompactTextString(m) }
+func (*Nests_RptGroup) ProtoMessage() {}
+func (*Nests_RptGroup) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{3, 1}
+}
+
+func (m *Nests_RptGroup) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Nests_RptGroup.Unmarshal(m, b)
+}
+func (m *Nests_RptGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Nests_RptGroup.Marshal(b, m, deterministic)
+}
+func (m *Nests_RptGroup) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Nests_RptGroup.Merge(m, src)
+}
+func (m *Nests_RptGroup) XXX_Size() int {
+ return xxx_messageInfo_Nests_RptGroup.Size(m)
+}
+func (m *Nests_RptGroup) XXX_DiscardUnknown() {
+ xxx_messageInfo_Nests_RptGroup.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Nests_RptGroup proto.InternalMessageInfo
+
+func (m *Nests_RptGroup) GetRptBool() []bool {
+ if m != nil {
+ return m.RptBool
+ }
+ return nil
+}
+
+// Message type used as submessage.
+type Nested struct {
+ OptString *string `protobuf:"bytes,1,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
+ OptNested *Nested `protobuf:"bytes,2,opt,name=opt_nested,json=optNested" json:"opt_nested,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Nested) Reset() { *m = Nested{} }
+func (m *Nested) String() string { return proto.CompactTextString(m) }
+func (*Nested) ProtoMessage() {}
+func (*Nested) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{4}
+}
+
+func (m *Nested) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Nested.Unmarshal(m, b)
+}
+func (m *Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Nested.Marshal(b, m, deterministic)
+}
+func (m *Nested) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Nested.Merge(m, src)
+}
+func (m *Nested) XXX_Size() int {
+ return xxx_messageInfo_Nested.Size(m)
+}
+func (m *Nested) XXX_DiscardUnknown() {
+ xxx_messageInfo_Nested.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Nested proto.InternalMessageInfo
+
+func (m *Nested) GetOptString() string {
+ if m != nil && m.OptString != nil {
+ return *m.OptString
+ }
+ return ""
+}
+
+func (m *Nested) GetOptNested() *Nested {
+ if m != nil {
+ return m.OptNested
+ }
+ return nil
+}
+
+// Message contains required fields.
+type Requireds struct {
+ ReqBool *bool `protobuf:"varint,1,req,name=req_bool,json=reqBool" json:"req_bool,omitempty"`
+ ReqFixed32 *uint32 `protobuf:"fixed32,2,req,name=req_fixed32,json=reqFixed32" json:"req_fixed32,omitempty"`
+ ReqFixed64 *uint64 `protobuf:"fixed64,3,req,name=req_fixed64,json=reqFixed64" json:"req_fixed64,omitempty"`
+ ReqSfixed32 *int32 `protobuf:"fixed32,4,req,name=req_sfixed32,json=reqSfixed32" json:"req_sfixed32,omitempty"`
+ ReqSfixed64 *int64 `protobuf:"fixed64,5,req,name=req_sfixed64,json=reqSfixed64" json:"req_sfixed64,omitempty"`
+ ReqFloat *float32 `protobuf:"fixed32,6,req,name=req_float,json=reqFloat" json:"req_float,omitempty"`
+ ReqDouble *float64 `protobuf:"fixed64,7,req,name=req_double,json=reqDouble" json:"req_double,omitempty"`
+ ReqString *string `protobuf:"bytes,8,req,name=req_string,json=reqString" json:"req_string,omitempty"`
+ ReqBytes []byte `protobuf:"bytes,9,req,name=req_bytes,json=reqBytes" json:"req_bytes,omitempty"`
+ ReqEnum *Enum `protobuf:"varint,10,req,name=req_enum,json=reqEnum,enum=pb2.Enum" json:"req_enum,omitempty"`
+ ReqNested *Nested `protobuf:"bytes,11,req,name=req_nested,json=reqNested" json:"req_nested,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Requireds) Reset() { *m = Requireds{} }
+func (m *Requireds) String() string { return proto.CompactTextString(m) }
+func (*Requireds) ProtoMessage() {}
+func (*Requireds) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{5}
+}
+
+func (m *Requireds) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Requireds.Unmarshal(m, b)
+}
+func (m *Requireds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Requireds.Marshal(b, m, deterministic)
+}
+func (m *Requireds) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Requireds.Merge(m, src)
+}
+func (m *Requireds) XXX_Size() int {
+ return xxx_messageInfo_Requireds.Size(m)
+}
+func (m *Requireds) XXX_DiscardUnknown() {
+ xxx_messageInfo_Requireds.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Requireds proto.InternalMessageInfo
+
+func (m *Requireds) GetReqBool() bool {
+ if m != nil && m.ReqBool != nil {
+ return *m.ReqBool
+ }
+ return false
+}
+
+func (m *Requireds) GetReqFixed32() uint32 {
+ if m != nil && m.ReqFixed32 != nil {
+ return *m.ReqFixed32
+ }
+ return 0
+}
+
+func (m *Requireds) GetReqFixed64() uint64 {
+ if m != nil && m.ReqFixed64 != nil {
+ return *m.ReqFixed64
+ }
+ return 0
+}
+
+func (m *Requireds) GetReqSfixed32() int32 {
+ if m != nil && m.ReqSfixed32 != nil {
+ return *m.ReqSfixed32
+ }
+ return 0
+}
+
+func (m *Requireds) GetReqSfixed64() int64 {
+ if m != nil && m.ReqSfixed64 != nil {
+ return *m.ReqSfixed64
+ }
+ return 0
+}
+
+func (m *Requireds) GetReqFloat() float32 {
+ if m != nil && m.ReqFloat != nil {
+ return *m.ReqFloat
+ }
+ return 0
+}
+
+func (m *Requireds) GetReqDouble() float64 {
+ if m != nil && m.ReqDouble != nil {
+ return *m.ReqDouble
+ }
+ return 0
+}
+
+func (m *Requireds) GetReqString() string {
+ if m != nil && m.ReqString != nil {
+ return *m.ReqString
+ }
+ return ""
+}
+
+func (m *Requireds) GetReqBytes() []byte {
+ if m != nil {
+ return m.ReqBytes
+ }
+ return nil
+}
+
+func (m *Requireds) GetReqEnum() Enum {
+ if m != nil && m.ReqEnum != nil {
+ return *m.ReqEnum
+ }
+ return Enum_UNKNOWN
+}
+
+func (m *Requireds) GetReqNested() *Nested {
+ if m != nil {
+ return m.ReqNested
+ }
+ return nil
+}
+
+// Message contains oneof field.
+type Oneofs struct {
+ // Types that are valid to be assigned to Union:
+ // *Oneofs_Str
+ // *Oneofs_Msg
+ Union isOneofs_Union `protobuf_oneof:"union"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Oneofs) Reset() { *m = Oneofs{} }
+func (m *Oneofs) String() string { return proto.CompactTextString(m) }
+func (*Oneofs) ProtoMessage() {}
+func (*Oneofs) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{6}
+}
+
+func (m *Oneofs) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Oneofs.Unmarshal(m, b)
+}
+func (m *Oneofs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Oneofs.Marshal(b, m, deterministic)
+}
+func (m *Oneofs) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Oneofs.Merge(m, src)
+}
+func (m *Oneofs) XXX_Size() int {
+ return xxx_messageInfo_Oneofs.Size(m)
+}
+func (m *Oneofs) XXX_DiscardUnknown() {
+ xxx_messageInfo_Oneofs.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Oneofs proto.InternalMessageInfo
+
+type isOneofs_Union interface {
+ isOneofs_Union()
+}
+
+type Oneofs_Str struct {
+ Str string `protobuf:"bytes,1,opt,name=str,oneof"`
+}
+
+type Oneofs_Msg struct {
+ Msg *Nested `protobuf:"bytes,2,opt,name=msg,oneof"`
+}
+
+func (*Oneofs_Str) isOneofs_Union() {}
+
+func (*Oneofs_Msg) isOneofs_Union() {}
+
+func (m *Oneofs) GetUnion() isOneofs_Union {
+ if m != nil {
+ return m.Union
+ }
+ return nil
+}
+
+func (m *Oneofs) GetStr() string {
+ if x, ok := m.GetUnion().(*Oneofs_Str); ok {
+ return x.Str
+ }
+ return ""
+}
+
+func (m *Oneofs) GetMsg() *Nested {
+ if x, ok := m.GetUnion().(*Oneofs_Msg); ok {
+ return x.Msg
+ }
+ return nil
+}
+
+// XXX_OneofFuncs is for the internal use of the proto package.
+func (*Oneofs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
+ return _Oneofs_OneofMarshaler, _Oneofs_OneofUnmarshaler, _Oneofs_OneofSizer, []interface{}{
+ (*Oneofs_Str)(nil),
+ (*Oneofs_Msg)(nil),
+ }
+}
+
+func _Oneofs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
+ m := msg.(*Oneofs)
+ // union
+ switch x := m.Union.(type) {
+ case *Oneofs_Str:
+ b.EncodeVarint(1<<3 | proto.WireBytes)
+ b.EncodeStringBytes(x.Str)
+ case *Oneofs_Msg:
+ b.EncodeVarint(2<<3 | proto.WireBytes)
+ if err := b.EncodeMessage(x.Msg); err != nil {
+ return err
+ }
+ case nil:
+ default:
+ return fmt.Errorf("Oneofs.Union has unexpected type %T", x)
+ }
+ return nil
+}
+
+func _Oneofs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
+ m := msg.(*Oneofs)
+ switch tag {
+ case 1: // union.str
+ if wire != proto.WireBytes {
+ return true, proto.ErrInternalBadWireType
+ }
+ x, err := b.DecodeStringBytes()
+ m.Union = &Oneofs_Str{x}
+ return true, err
+ case 2: // union.msg
+ if wire != proto.WireBytes {
+ return true, proto.ErrInternalBadWireType
+ }
+ msg := new(Nested)
+ err := b.DecodeMessage(msg)
+ m.Union = &Oneofs_Msg{msg}
+ return true, err
+ default:
+ return false, nil
+ }
+}
+
+func _Oneofs_OneofSizer(msg proto.Message) (n int) {
+ m := msg.(*Oneofs)
+ // union
+ switch x := m.Union.(type) {
+ case *Oneofs_Str:
+ n += 1 // tag and wire
+ n += proto.SizeVarint(uint64(len(x.Str)))
+ n += len(x.Str)
+ case *Oneofs_Msg:
+ s := proto.Size(x.Msg)
+ n += 1 // tag and wire
+ n += proto.SizeVarint(uint64(s))
+ n += s
+ case nil:
+ default:
+ panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
+ }
+ return n
+}
+
+// Message contains map fields.
+type Maps struct {
+ Int32ToStr map[int32]string `protobuf:"bytes,1,rep,name=int32_to_str,json=int32ToStr" json:"int32_to_str,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ Sfixed64ToBool map[int64]bool `protobuf:"bytes,2,rep,name=sfixed64_to_bool,json=sfixed64ToBool" json:"sfixed64_to_bool,omitempty" protobuf_key:"fixed64,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
+ BoolToUint32 map[bool]uint32 `protobuf:"bytes,3,rep,name=bool_to_uint32,json=boolToUint32" json:"bool_to_uint32,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
+ Uint64ToEnum map[uint64]Enum `protobuf:"bytes,4,rep,name=uint64_to_enum,json=uint64ToEnum" json:"uint64_to_enum,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=pb2.Enum"`
+ StrToNested map[string]*Nested `protobuf:"bytes,5,rep,name=str_to_nested,json=strToNested" json:"str_to_nested,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ StrToOneofs map[string]*Oneofs `protobuf:"bytes,6,rep,name=str_to_oneofs,json=strToOneofs" json:"str_to_oneofs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Maps) Reset() { *m = Maps{} }
+func (m *Maps) String() string { return proto.CompactTextString(m) }
+func (*Maps) ProtoMessage() {}
+func (*Maps) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{7}
+}
+
+func (m *Maps) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Maps.Unmarshal(m, b)
+}
+func (m *Maps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Maps.Marshal(b, m, deterministic)
+}
+func (m *Maps) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Maps.Merge(m, src)
+}
+func (m *Maps) XXX_Size() int {
+ return xxx_messageInfo_Maps.Size(m)
+}
+func (m *Maps) XXX_DiscardUnknown() {
+ xxx_messageInfo_Maps.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Maps proto.InternalMessageInfo
+
+func (m *Maps) GetInt32ToStr() map[int32]string {
+ if m != nil {
+ return m.Int32ToStr
+ }
+ return nil
+}
+
+func (m *Maps) GetSfixed64ToBool() map[int64]bool {
+ if m != nil {
+ return m.Sfixed64ToBool
+ }
+ return nil
+}
+
+func (m *Maps) GetBoolToUint32() map[bool]uint32 {
+ if m != nil {
+ return m.BoolToUint32
+ }
+ return nil
+}
+
+func (m *Maps) GetUint64ToEnum() map[uint64]Enum {
+ if m != nil {
+ return m.Uint64ToEnum
+ }
+ return nil
+}
+
+func (m *Maps) GetStrToNested() map[string]*Nested {
+ if m != nil {
+ return m.StrToNested
+ }
+ return nil
+}
+
+func (m *Maps) GetStrToOneofs() map[string]*Oneofs {
+ if m != nil {
+ return m.StrToOneofs
+ }
+ return nil
+}
+
+// Message contains well-known type fields.
+type KnownTypes struct {
+ OptBool *wrappers.BoolValue `protobuf:"bytes,1,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`
+ OptInt32 *wrappers.Int32Value `protobuf:"bytes,2,opt,name=opt_int32,json=optInt32" json:"opt_int32,omitempty"`
+ OptInt64 *wrappers.Int64Value `protobuf:"bytes,3,opt,name=opt_int64,json=optInt64" json:"opt_int64,omitempty"`
+ OptUint32 *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=opt_uint32,json=optUint32" json:"opt_uint32,omitempty"`
+ OptUint64 *wrappers.UInt64Value `protobuf:"bytes,5,opt,name=opt_uint64,json=optUint64" json:"opt_uint64,omitempty"`
+ OptFloat *wrappers.FloatValue `protobuf:"bytes,6,opt,name=opt_float,json=optFloat" json:"opt_float,omitempty"`
+ OptDouble *wrappers.DoubleValue `protobuf:"bytes,7,opt,name=opt_double,json=optDouble" json:"opt_double,omitempty"`
+ OptString *wrappers.StringValue `protobuf:"bytes,8,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
+ OptBytes *wrappers.BytesValue `protobuf:"bytes,9,opt,name=opt_bytes,json=optBytes" json:"opt_bytes,omitempty"`
+ OptDuration *duration.Duration `protobuf:"bytes,20,opt,name=opt_duration,json=optDuration" json:"opt_duration,omitempty"`
+ OptTimestamp *timestamp.Timestamp `protobuf:"bytes,21,opt,name=opt_timestamp,json=optTimestamp" json:"opt_timestamp,omitempty"`
+ OptStruct *_struct.Struct `protobuf:"bytes,25,opt,name=opt_struct,json=optStruct" json:"opt_struct,omitempty"`
+ OptList *_struct.ListValue `protobuf:"bytes,26,opt,name=opt_list,json=optList" json:"opt_list,omitempty"`
+ OptValue *_struct.Value `protobuf:"bytes,27,opt,name=opt_value,json=optValue" json:"opt_value,omitempty"`
+ OptEmpty *empty.Empty `protobuf:"bytes,30,opt,name=opt_empty,json=optEmpty" json:"opt_empty,omitempty"`
+ OptAny *any.Any `protobuf:"bytes,32,opt,name=opt_any,json=optAny" json:"opt_any,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *KnownTypes) Reset() { *m = KnownTypes{} }
+func (m *KnownTypes) String() string { return proto.CompactTextString(m) }
+func (*KnownTypes) ProtoMessage() {}
+func (*KnownTypes) Descriptor() ([]byte, []int) {
+ return fileDescriptor_c8d7acc1bcec9a72, []int{8}
+}
+
+func (m *KnownTypes) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_KnownTypes.Unmarshal(m, b)
+}
+func (m *KnownTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_KnownTypes.Marshal(b, m, deterministic)
+}
+func (m *KnownTypes) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_KnownTypes.Merge(m, src)
+}
+func (m *KnownTypes) XXX_Size() int {
+ return xxx_messageInfo_KnownTypes.Size(m)
+}
+func (m *KnownTypes) XXX_DiscardUnknown() {
+ xxx_messageInfo_KnownTypes.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_KnownTypes proto.InternalMessageInfo
+
+func (m *KnownTypes) GetOptBool() *wrappers.BoolValue {
+ if m != nil {
+ return m.OptBool
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptInt32() *wrappers.Int32Value {
+ if m != nil {
+ return m.OptInt32
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptInt64() *wrappers.Int64Value {
+ if m != nil {
+ return m.OptInt64
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptUint32() *wrappers.UInt32Value {
+ if m != nil {
+ return m.OptUint32
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptUint64() *wrappers.UInt64Value {
+ if m != nil {
+ return m.OptUint64
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptFloat() *wrappers.FloatValue {
+ if m != nil {
+ return m.OptFloat
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptDouble() *wrappers.DoubleValue {
+ if m != nil {
+ return m.OptDouble
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptString() *wrappers.StringValue {
+ if m != nil {
+ return m.OptString
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptBytes() *wrappers.BytesValue {
+ if m != nil {
+ return m.OptBytes
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptDuration() *duration.Duration {
+ if m != nil {
+ return m.OptDuration
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptTimestamp() *timestamp.Timestamp {
+ if m != nil {
+ return m.OptTimestamp
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptStruct() *_struct.Struct {
+ if m != nil {
+ return m.OptStruct
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptList() *_struct.ListValue {
+ if m != nil {
+ return m.OptList
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptValue() *_struct.Value {
+ if m != nil {
+ return m.OptValue
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptEmpty() *empty.Empty {
+ if m != nil {
+ return m.OptEmpty
+ }
+ return nil
+}
+
+func (m *KnownTypes) GetOptAny() *any.Any {
+ if m != nil {
+ return m.OptAny
+ }
+ return nil
+}
+
+func init() {
+ proto.RegisterEnum("pb2.Enum", Enum_name, Enum_value)
+ proto.RegisterEnum("pb2.Enums_NestedEnum", Enums_NestedEnum_name, Enums_NestedEnum_value)
+ proto.RegisterType((*Scalars)(nil), "pb2.Scalars")
+ proto.RegisterType((*Repeats)(nil), "pb2.Repeats")
+ proto.RegisterType((*Enums)(nil), "pb2.Enums")
+ proto.RegisterType((*Nests)(nil), "pb2.Nests")
+ proto.RegisterType((*Nests_OptGroup)(nil), "pb2.Nests.OptGroup")
+ proto.RegisterType((*Nests_OptGroup_OptNestedGroup)(nil), "pb2.Nests.OptGroup.OptNestedGroup")
+ proto.RegisterType((*Nests_RptGroup)(nil), "pb2.Nests.RptGroup")
+ proto.RegisterType((*Nested)(nil), "pb2.Nested")
+ proto.RegisterType((*Requireds)(nil), "pb2.Requireds")
+ proto.RegisterType((*Oneofs)(nil), "pb2.Oneofs")
+ proto.RegisterType((*Maps)(nil), "pb2.Maps")
+ proto.RegisterMapType((map[bool]uint32)(nil), "pb2.Maps.BoolToUint32Entry")
+ proto.RegisterMapType((map[int32]string)(nil), "pb2.Maps.Int32ToStrEntry")
+ proto.RegisterMapType((map[int64]bool)(nil), "pb2.Maps.Sfixed64ToBoolEntry")
+ proto.RegisterMapType((map[string]*Nested)(nil), "pb2.Maps.StrToNestedEntry")
+ proto.RegisterMapType((map[string]*Oneofs)(nil), "pb2.Maps.StrToOneofsEntry")
+ proto.RegisterMapType((map[uint64]Enum)(nil), "pb2.Maps.Uint64ToEnumEntry")
+ proto.RegisterType((*KnownTypes)(nil), "pb2.KnownTypes")
+}
+
+func init() {
+ proto.RegisterFile("encoding/textpb/testprotos/pb2/test.proto", fileDescriptor_c8d7acc1bcec9a72)
+}
+
+var fileDescriptor_c8d7acc1bcec9a72 = []byte{
+ // 1521 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x58, 0xdb, 0x6e, 0xdb, 0x46,
+ 0x10, 0x0d, 0x49, 0x5d, 0x57, 0xbe, 0x28, 0x4c, 0xd2, 0xd2, 0x72, 0x12, 0x33, 0x42, 0x0a, 0xb0,
+ 0x01, 0x2a, 0x01, 0x8a, 0x22, 0x18, 0x75, 0x2e, 0xb0, 0x6b, 0x3b,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c3,
+ 0x74, 0xef, 0xe4, 0xac, 0xf7, 0xa6, 0x4a, 0x8e, 0x5e, 0x7e, 0x78, 0x3e, 0x1a, 0x8b, 0x5f, 0xc3,
+ 0x41, 0x63, 0xc8, 0xa6, 0xcd, 0x11, 0x9b, 0xf4, 0xbd, 0x51, 0xfa, 0xd9, 0xfc, 0xb1, 0xd5, 0xbc,
+ 0xf9, 0x0f, 0x81, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x64, 0x29, 0xf9, 0x97, 0x31, 0x10, 0x00,
+ 0x00,
+}
diff --git a/encoding/textpb/testprotos/pb2/test.proto b/encoding/textpb/testprotos/pb2/test.proto
new file mode 100644
index 0000000..21edaca
--- /dev/null
+++ b/encoding/textpb/testprotos/pb2/test.proto
@@ -0,0 +1,151 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test Protobuf definitions with proto2 syntax.
+syntax = "proto2";
+
+package pb2;
+option go_package = "github.com/golang/protobuf/v2/encoding/textpb/testprotos/pb2";
+
+import "google/protobuf/any.proto";
+import "google/protobuf/empty.proto";
+import "google/protobuf/duration.proto";
+import "google/protobuf/struct.proto";
+import "google/protobuf/timestamp.proto";
+import "google/protobuf/wrappers.proto";
+
+// Scalars contains optional scalar fields.
+message Scalars {
+ optional bool opt_bool = 1;
+
+ optional int32 opt_int32 = 2;
+ optional int64 opt_int64 = 3;
+ optional uint32 opt_uint32 = 4;
+ optional uint64 opt_uint64 = 5;
+ optional sint32 opt_sint32 = 6;
+ optional sint64 opt_sint64 = 7;
+ optional fixed32 opt_fixed32 = 8;
+ optional fixed64 opt_fixed64 = 9;
+ optional sfixed32 opt_sfixed32 = 10;
+ optional sfixed64 opt_sfixed64 = 11;
+
+ optional float opt_float = 20;
+ optional double opt_double = 21;
+
+ optional bytes opt_bytes = 14;
+ optional string opt_string = 13;
+}
+
+// Message contains repeated fields.
+message Repeats {
+ repeated bool rpt_bool = 1;
+ repeated int32 rpt_int32 = 2;
+ repeated int64 rpt_int64 = 3;
+ repeated uint32 rpt_uint32 = 4;
+ repeated uint64 rpt_uint64 = 5;
+ repeated float rpt_float = 6;
+ repeated double rpt_double = 7;
+ repeated string rpt_string = 15;
+ repeated bytes rpt_bytes = 14;
+}
+
+enum Enum {
+ UNKNOWN = 0;
+ FIRST = 1;
+ SECOND = 2;
+ TENTH = 10;
+}
+
+// Message contains enum fields.
+message Enums {
+ optional Enum opt_enum = 1;
+ repeated Enum rpt_enum = 2;
+
+ enum NestedEnum {
+ UNO = 1;
+ DOS = 2;
+ DIEZ = 10;
+ }
+ optional NestedEnum opt_nested_enum = 3;
+ repeated NestedEnum rpt_nested_enum = 4;
+}
+
+// Message contains message and group fields.
+message Nests {
+ optional Nested opt_nested = 1;
+ optional group OptGroup = 2 {
+ optional bool opt_bool = 1;
+ optional string opt_string = 2;
+ optional Nested opt_nested = 3;
+
+ optional group OptNestedGroup = 4 {
+ optional Enum opt_enum = 1;
+ }
+ }
+
+ repeated Nested rpt_nested = 3;
+ repeated group RptGroup = 4 {
+ repeated bool rpt_bool = 1;
+ }
+}
+
+// Message type used as submessage.
+message Nested {
+ optional string opt_string = 1;
+ optional Nested opt_nested = 2;
+}
+
+// Message contains required fields.
+message Requireds {
+ required bool req_bool = 1;
+ required fixed32 req_fixed32 = 2;
+ required fixed64 req_fixed64 = 3;
+ required sfixed32 req_sfixed32 = 4;
+ required sfixed64 req_sfixed64 = 5;
+ required float req_float = 6;
+ required double req_double = 7;
+ required string req_string = 8;
+ required bytes req_bytes = 9;
+ required Enum req_enum = 10;
+ required Nested req_nested = 11;
+}
+
+// Message contains oneof field.
+message Oneofs {
+ oneof union {
+ string str = 1;
+ Nested msg = 2;
+ }
+}
+
+// Message contains map fields.
+message Maps {
+ map<int32, string> int32_to_str = 1;
+ map<sfixed64, bool> sfixed64_to_bool = 2;
+ map<bool, uint32> bool_to_uint32 = 3;
+ map<uint64, Enum> uint64_to_enum = 4;
+ map<string, Nested> str_to_nested = 5;
+ map<string, Oneofs> str_to_oneofs = 6;
+}
+
+// Message contains well-known type fields.
+message KnownTypes {
+ optional google.protobuf.BoolValue opt_bool = 1;
+ optional google.protobuf.Int32Value opt_int32 = 2;
+ optional google.protobuf.Int64Value opt_int64 = 3;
+ optional google.protobuf.UInt32Value opt_uint32 = 4;
+ optional google.protobuf.UInt64Value opt_uint64 = 5;
+ optional google.protobuf.FloatValue opt_float = 6;
+ optional google.protobuf.DoubleValue opt_double = 7;
+ optional google.protobuf.StringValue opt_string = 8;
+ optional google.protobuf.BytesValue opt_bytes = 9;
+
+ optional google.protobuf.Duration opt_duration = 20;
+ optional google.protobuf.Timestamp opt_timestamp = 21;
+ optional google.protobuf.Struct opt_struct = 25;
+ optional google.protobuf.ListValue opt_list = 26;
+ optional google.protobuf.Value opt_value = 27;
+ optional google.protobuf.Empty opt_empty = 30;
+ optional google.protobuf.Any opt_any = 32;
+}
diff --git a/encoding/textpb/testprotos/pb3/test.pb.go b/encoding/textpb/testprotos/pb3/test.pb.go
new file mode 100644
index 0000000..c5c2fb2
--- /dev/null
+++ b/encoding/textpb/testprotos/pb3/test.pb.go
@@ -0,0 +1,449 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: encoding/textpb/testprotos/pb3/test.proto
+
+package pb3
+
+import (
+ fmt "fmt"
+ proto "github.com/golang/protobuf/proto"
+ _ "github.com/golang/protobuf/ptypes/struct"
+ math "math"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
+type Enum int32
+
+const (
+ Enum_ZERO Enum = 0
+ Enum_ONE Enum = 1
+ Enum_TWO Enum = 2
+ Enum_TEN Enum = 10
+)
+
+var Enum_name = map[int32]string{
+ 0: "ZERO",
+ 1: "ONE",
+ 2: "TWO",
+ 10: "TEN",
+}
+
+var Enum_value = map[string]int32{
+ "ZERO": 0,
+ "ONE": 1,
+ "TWO": 2,
+ "TEN": 10,
+}
+
+func (x Enum) String() string {
+ return proto.EnumName(Enum_name, int32(x))
+}
+
+func (Enum) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_0854715c5b41c422, []int{0}
+}
+
+type Enums_NestedEnum int32
+
+const (
+ Enums_CERO Enums_NestedEnum = 0
+ Enums_UNO Enums_NestedEnum = 1
+ Enums_DOS Enums_NestedEnum = 2
+ Enums_DIEZ Enums_NestedEnum = 10
+)
+
+var Enums_NestedEnum_name = map[int32]string{
+ 0: "CERO",
+ 1: "UNO",
+ 2: "DOS",
+ 10: "DIEZ",
+}
+
+var Enums_NestedEnum_value = map[string]int32{
+ "CERO": 0,
+ "UNO": 1,
+ "DOS": 2,
+ "DIEZ": 10,
+}
+
+func (x Enums_NestedEnum) String() string {
+ return proto.EnumName(Enums_NestedEnum_name, int32(x))
+}
+
+func (Enums_NestedEnum) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_0854715c5b41c422, []int{1, 0}
+}
+
+// Scalars contains scalar field types.
+type Scalars struct {
+ SBool bool `protobuf:"varint,1,opt,name=s_bool,json=sBool,proto3" json:"s_bool,omitempty"`
+ SInt32 int32 `protobuf:"varint,2,opt,name=s_int32,json=sInt32,proto3" json:"s_int32,omitempty"`
+ SInt64 int64 `protobuf:"varint,3,opt,name=s_int64,json=sInt64,proto3" json:"s_int64,omitempty"`
+ SUint32 uint32 `protobuf:"varint,4,opt,name=s_uint32,json=sUint32,proto3" json:"s_uint32,omitempty"`
+ SUint64 uint64 `protobuf:"varint,5,opt,name=s_uint64,json=sUint64,proto3" json:"s_uint64,omitempty"`
+ SSint32 int32 `protobuf:"zigzag32,6,opt,name=s_sint32,json=sSint32,proto3" json:"s_sint32,omitempty"`
+ SSint64 int64 `protobuf:"zigzag64,7,opt,name=s_sint64,json=sSint64,proto3" json:"s_sint64,omitempty"`
+ SFixed32 uint32 `protobuf:"fixed32,8,opt,name=s_fixed32,json=sFixed32,proto3" json:"s_fixed32,omitempty"`
+ SFixed64 uint64 `protobuf:"fixed64,9,opt,name=s_fixed64,json=sFixed64,proto3" json:"s_fixed64,omitempty"`
+ SSfixed32 int32 `protobuf:"fixed32,10,opt,name=s_sfixed32,json=sSfixed32,proto3" json:"s_sfixed32,omitempty"`
+ SSfixed64 int64 `protobuf:"fixed64,11,opt,name=s_sfixed64,json=sSfixed64,proto3" json:"s_sfixed64,omitempty"`
+ SFloat float32 `protobuf:"fixed32,20,opt,name=s_float,json=sFloat,proto3" json:"s_float,omitempty"`
+ SDouble float64 `protobuf:"fixed64,21,opt,name=s_double,json=sDouble,proto3" json:"s_double,omitempty"`
+ SBytes []byte `protobuf:"bytes,14,opt,name=s_bytes,json=sBytes,proto3" json:"s_bytes,omitempty"`
+ SString string `protobuf:"bytes,13,opt,name=s_string,json=sString,proto3" json:"s_string,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Scalars) Reset() { *m = Scalars{} }
+func (m *Scalars) String() string { return proto.CompactTextString(m) }
+func (*Scalars) ProtoMessage() {}
+func (*Scalars) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0854715c5b41c422, []int{0}
+}
+
+func (m *Scalars) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Scalars.Unmarshal(m, b)
+}
+func (m *Scalars) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Scalars.Marshal(b, m, deterministic)
+}
+func (m *Scalars) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Scalars.Merge(m, src)
+}
+func (m *Scalars) XXX_Size() int {
+ return xxx_messageInfo_Scalars.Size(m)
+}
+func (m *Scalars) XXX_DiscardUnknown() {
+ xxx_messageInfo_Scalars.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Scalars proto.InternalMessageInfo
+
+func (m *Scalars) GetSBool() bool {
+ if m != nil {
+ return m.SBool
+ }
+ return false
+}
+
+func (m *Scalars) GetSInt32() int32 {
+ if m != nil {
+ return m.SInt32
+ }
+ return 0
+}
+
+func (m *Scalars) GetSInt64() int64 {
+ if m != nil {
+ return m.SInt64
+ }
+ return 0
+}
+
+func (m *Scalars) GetSUint32() uint32 {
+ if m != nil {
+ return m.SUint32
+ }
+ return 0
+}
+
+func (m *Scalars) GetSUint64() uint64 {
+ if m != nil {
+ return m.SUint64
+ }
+ return 0
+}
+
+func (m *Scalars) GetSSint32() int32 {
+ if m != nil {
+ return m.SSint32
+ }
+ return 0
+}
+
+func (m *Scalars) GetSSint64() int64 {
+ if m != nil {
+ return m.SSint64
+ }
+ return 0
+}
+
+func (m *Scalars) GetSFixed32() uint32 {
+ if m != nil {
+ return m.SFixed32
+ }
+ return 0
+}
+
+func (m *Scalars) GetSFixed64() uint64 {
+ if m != nil {
+ return m.SFixed64
+ }
+ return 0
+}
+
+func (m *Scalars) GetSSfixed32() int32 {
+ if m != nil {
+ return m.SSfixed32
+ }
+ return 0
+}
+
+func (m *Scalars) GetSSfixed64() int64 {
+ if m != nil {
+ return m.SSfixed64
+ }
+ return 0
+}
+
+func (m *Scalars) GetSFloat() float32 {
+ if m != nil {
+ return m.SFloat
+ }
+ return 0
+}
+
+func (m *Scalars) GetSDouble() float64 {
+ if m != nil {
+ return m.SDouble
+ }
+ return 0
+}
+
+func (m *Scalars) GetSBytes() []byte {
+ if m != nil {
+ return m.SBytes
+ }
+ return nil
+}
+
+func (m *Scalars) GetSString() string {
+ if m != nil {
+ return m.SString
+ }
+ return ""
+}
+
+// Message contains enum fields.
+type Enums struct {
+ SEnum Enum `protobuf:"varint,1,opt,name=s_enum,json=sEnum,proto3,enum=pb3.Enum" json:"s_enum,omitempty"`
+ RptEnum []Enum `protobuf:"varint,2,rep,packed,name=rpt_enum,json=rptEnum,proto3,enum=pb3.Enum" json:"rpt_enum,omitempty"`
+ SNestedEnum Enums_NestedEnum `protobuf:"varint,3,opt,name=s_nested_enum,json=sNestedEnum,proto3,enum=pb3.Enums_NestedEnum" json:"s_nested_enum,omitempty"`
+ RptNestedEnum []Enums_NestedEnum `protobuf:"varint,4,rep,packed,name=rpt_nested_enum,json=rptNestedEnum,proto3,enum=pb3.Enums_NestedEnum" json:"rpt_nested_enum,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Enums) Reset() { *m = Enums{} }
+func (m *Enums) String() string { return proto.CompactTextString(m) }
+func (*Enums) ProtoMessage() {}
+func (*Enums) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0854715c5b41c422, []int{1}
+}
+
+func (m *Enums) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Enums.Unmarshal(m, b)
+}
+func (m *Enums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Enums.Marshal(b, m, deterministic)
+}
+func (m *Enums) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Enums.Merge(m, src)
+}
+func (m *Enums) XXX_Size() int {
+ return xxx_messageInfo_Enums.Size(m)
+}
+func (m *Enums) XXX_DiscardUnknown() {
+ xxx_messageInfo_Enums.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Enums proto.InternalMessageInfo
+
+func (m *Enums) GetSEnum() Enum {
+ if m != nil {
+ return m.SEnum
+ }
+ return Enum_ZERO
+}
+
+func (m *Enums) GetRptEnum() []Enum {
+ if m != nil {
+ return m.RptEnum
+ }
+ return nil
+}
+
+func (m *Enums) GetSNestedEnum() Enums_NestedEnum {
+ if m != nil {
+ return m.SNestedEnum
+ }
+ return Enums_CERO
+}
+
+func (m *Enums) GetRptNestedEnum() []Enums_NestedEnum {
+ if m != nil {
+ return m.RptNestedEnum
+ }
+ return nil
+}
+
+// Message contains message and group fields.
+type Nests struct {
+ SNested *Nested `protobuf:"bytes,1,opt,name=s_nested,json=sNested,proto3" json:"s_nested,omitempty"`
+ RptNested []*Nested `protobuf:"bytes,2,rep,name=rpt_nested,json=rptNested,proto3" json:"rpt_nested,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Nests) Reset() { *m = Nests{} }
+func (m *Nests) String() string { return proto.CompactTextString(m) }
+func (*Nests) ProtoMessage() {}
+func (*Nests) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0854715c5b41c422, []int{2}
+}
+
+func (m *Nests) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Nests.Unmarshal(m, b)
+}
+func (m *Nests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Nests.Marshal(b, m, deterministic)
+}
+func (m *Nests) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Nests.Merge(m, src)
+}
+func (m *Nests) XXX_Size() int {
+ return xxx_messageInfo_Nests.Size(m)
+}
+func (m *Nests) XXX_DiscardUnknown() {
+ xxx_messageInfo_Nests.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Nests proto.InternalMessageInfo
+
+func (m *Nests) GetSNested() *Nested {
+ if m != nil {
+ return m.SNested
+ }
+ return nil
+}
+
+func (m *Nests) GetRptNested() []*Nested {
+ if m != nil {
+ return m.RptNested
+ }
+ return nil
+}
+
+// Message type used as submessage.
+type Nested struct {
+ SString string `protobuf:"bytes,1,opt,name=s_string,json=sString,proto3" json:"s_string,omitempty"`
+ SNested *Nested `protobuf:"bytes,2,opt,name=s_nested,json=sNested,proto3" json:"s_nested,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Nested) Reset() { *m = Nested{} }
+func (m *Nested) String() string { return proto.CompactTextString(m) }
+func (*Nested) ProtoMessage() {}
+func (*Nested) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0854715c5b41c422, []int{3}
+}
+
+func (m *Nested) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Nested.Unmarshal(m, b)
+}
+func (m *Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Nested.Marshal(b, m, deterministic)
+}
+func (m *Nested) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Nested.Merge(m, src)
+}
+func (m *Nested) XXX_Size() int {
+ return xxx_messageInfo_Nested.Size(m)
+}
+func (m *Nested) XXX_DiscardUnknown() {
+ xxx_messageInfo_Nested.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Nested proto.InternalMessageInfo
+
+func (m *Nested) GetSString() string {
+ if m != nil {
+ return m.SString
+ }
+ return ""
+}
+
+func (m *Nested) GetSNested() *Nested {
+ if m != nil {
+ return m.SNested
+ }
+ return nil
+}
+
+func init() {
+ proto.RegisterEnum("pb3.Enum", Enum_name, Enum_value)
+ proto.RegisterEnum("pb3.Enums_NestedEnum", Enums_NestedEnum_name, Enums_NestedEnum_value)
+ proto.RegisterType((*Scalars)(nil), "pb3.Scalars")
+ proto.RegisterType((*Enums)(nil), "pb3.Enums")
+ proto.RegisterType((*Nests)(nil), "pb3.Nests")
+ proto.RegisterType((*Nested)(nil), "pb3.Nested")
+}
+
+func init() {
+ proto.RegisterFile("encoding/textpb/testprotos/pb3/test.proto", fileDescriptor_0854715c5b41c422)
+}
+
+var fileDescriptor_0854715c5b41c422 = []byte{
+ // 566 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x5f, 0x6b, 0xdb, 0x3e,
+ 0x14, 0xfd, 0x29, 0x4e, 0xec, 0xe4, 0xe6, 0x97, 0xd6, 0x13, 0x2b, 0xf3, 0xfe, 0x81, 0x08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+}
diff --git a/encoding/textpb/testprotos/pb3/test.proto b/encoding/textpb/testprotos/pb3/test.proto
new file mode 100644
index 0000000..9825b75
--- /dev/null
+++ b/encoding/textpb/testprotos/pb3/test.proto
@@ -0,0 +1,65 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test Protobuf definitions with proto3 syntax.
+syntax = "proto3";
+
+package pb3;
+option go_package = "github.com/golang/protobuf/v2/encoding/textpb/testprotos/pb3";
+
+// Scalars contains scalar field types.
+message Scalars {
+ bool s_bool = 1;
+
+ int32 s_int32 = 2;
+ int64 s_int64 = 3;
+ uint32 s_uint32 = 4;
+ uint64 s_uint64 = 5;
+ sint32 s_sint32 = 6;
+ sint64 s_sint64 = 7;
+ fixed32 s_fixed32 = 8;
+ fixed64 s_fixed64 = 9;
+ sfixed32 s_sfixed32 = 10;
+ sfixed64 s_sfixed64 = 11;
+
+ float s_float = 20;
+ double s_double = 21;
+
+ bytes s_bytes = 14;
+ string s_string = 13;
+}
+
+enum Enum {
+ ZERO = 0;
+ ONE = 1;
+ TWO = 2;
+ TEN = 10;
+}
+
+// Message contains enum fields.
+message Enums {
+ Enum s_enum = 1;
+ repeated Enum rpt_enum = 2;
+
+ enum NestedEnum {
+ CERO = 0;
+ UNO = 1;
+ DOS = 2;
+ DIEZ = 10;
+ }
+ NestedEnum s_nested_enum = 3;
+ repeated NestedEnum rpt_nested_enum = 4;
+}
+
+// Message contains message and group fields.
+message Nests {
+ Nested s_nested = 1;
+ repeated Nested rpt_nested = 2;
+}
+
+// Message type used as submessage.
+message Nested {
+ string s_string = 1;
+ Nested s_nested = 2;
+}