cmd/protoc-gen-go: add support for map fields

Generate the proper map[key]value type for map fields.
Include the protobuf_key and protobuf_val field tags.
Do not generate the map entry structs.

Fix an initialization order bug in protogen: While proto files cannot
contain circular dependencies, a single file can contain dependency
cycles. First create types for all the descriptors in a file, then add
in references (currently just field->message and field->enum) in a
second pass.

Change-Id: Ifedfa657d8dbb00413ba493adee1119b19c1b773
Reviewed-on: https://go-review.googlesource.com/135355
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
Damien Neil 2018-09-13 15:07:10 -07:00
parent 77f82fe6bc
commit 0bd5a38474
6 changed files with 339 additions and 221 deletions

View File

@ -246,6 +246,10 @@ func enumRegistryName(enum *protogen.Enum) string {
}
func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *File, message *protogen.Message) {
if message.Desc.IsMapEntry() {
return
}
for _, e := range message.Enums {
genEnum(gen, g, f, e)
}
@ -263,7 +267,19 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *File, messag
if pointer {
goType = "*" + goType
}
g.P(field.GoIdent, " ", goType, fmt.Sprintf(" `protobuf:%q json:%q`", fieldProtobufTag(field), fieldJSONTag(field)))
tags := []string{
fmt.Sprintf("protobuf:%q", fieldProtobufTag(field)),
fmt.Sprintf("json:%q", fieldJSONTag(field)),
}
if field.Desc.IsMap() {
key := field.MessageType.Fields[0]
val := field.MessageType.Fields[1]
tags = append(tags,
fmt.Sprintf("protobuf_key:%q", fieldProtobufTag(key)),
fmt.Sprintf("protobuf_val:%q", fieldProtobufTag(val)),
)
}
g.P(field.GoIdent, " ", goType, " `", strings.Join(tags, " "), "`")
}
g.P("XXX_NoUnkeyedLiteral struct{} `json:\"-\"`")
// TODO XXX_InternalExtensions
@ -408,7 +424,6 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *File, messag
//
// If it returns pointer=true, the struct field is a pointer to the type.
func fieldGoType(g *protogen.GeneratedFile, field *protogen.Field) (goType string, pointer bool) {
// TODO: map types
pointer = true
switch field.Desc.Kind() {
case protoreflect.BoolKind:
@ -433,6 +448,11 @@ func fieldGoType(g *protogen.GeneratedFile, field *protogen.Field) (goType strin
goType = "[]byte"
pointer = false
case protoreflect.MessageKind, protoreflect.GroupKind:
if field.Desc.IsMap() {
keyType, _ := fieldGoType(g, field.MessageType.Fields[0])
valType, _ := fieldGoType(g, field.MessageType.Fields[1])
return fmt.Sprintf("map[%v]%v", keyType, valType), false
}
goType = "*" + g.QualifiedGoIdent(field.MessageType.GoIdent)
pointer = false
}

View File

@ -55,85 +55,88 @@ func (FieldTestMessage_Enum) EnumDescriptor() ([]byte, []int) {
}
type FieldTestMessage struct {
OptionalBool *bool `protobuf:"varint,1,opt,name=optional_bool,json=optionalBool" json:"optional_bool,omitempty"`
OptionalEnum *FieldTestMessage_Enum `protobuf:"varint,2,opt,name=optional_enum,json=optionalEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum" json:"optional_enum,omitempty"`
OptionalInt32 *int32 `protobuf:"varint,3,opt,name=optional_int32,json=optionalInt32" json:"optional_int32,omitempty"`
OptionalSint32 *int32 `protobuf:"zigzag32,4,opt,name=optional_sint32,json=optionalSint32" json:"optional_sint32,omitempty"`
OptionalUint32 *uint32 `protobuf:"varint,5,opt,name=optional_uint32,json=optionalUint32" json:"optional_uint32,omitempty"`
OptionalInt64 *int64 `protobuf:"varint,6,opt,name=optional_int64,json=optionalInt64" json:"optional_int64,omitempty"`
OptionalSint64 *int64 `protobuf:"zigzag64,7,opt,name=optional_sint64,json=optionalSint64" json:"optional_sint64,omitempty"`
OptionalUint64 *uint64 `protobuf:"varint,8,opt,name=optional_uint64,json=optionalUint64" json:"optional_uint64,omitempty"`
OptionalSfixed32 *int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32" json:"optional_sfixed32,omitempty"`
OptionalFixed32 *uint32 `protobuf:"fixed32,10,opt,name=optional_fixed32,json=optionalFixed32" json:"optional_fixed32,omitempty"`
OptionalFloat *float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat" json:"optional_float,omitempty"`
OptionalSfixed64 *int64 `protobuf:"fixed64,12,opt,name=optional_sfixed64,json=optionalSfixed64" json:"optional_sfixed64,omitempty"`
OptionalFixed64 *uint64 `protobuf:"fixed64,13,opt,name=optional_fixed64,json=optionalFixed64" json:"optional_fixed64,omitempty"`
OptionalDouble *float64 `protobuf:"fixed64,14,opt,name=optional_double,json=optionalDouble" json:"optional_double,omitempty"`
OptionalString *string `protobuf:"bytes,15,opt,name=optional_string,json=optionalString" json:"optional_string,omitempty"`
OptionalBytes []byte `protobuf:"bytes,16,opt,name=optional_bytes,json=optionalBytes" json:"optional_bytes,omitempty"`
Optional_Message *FieldTestMessage_Message `protobuf:"bytes,17,opt,name=optional_Message,json=optionalMessage" json:"optional_Message,omitempty"`
Optionalgroup *FieldTestMessage_OptionalGroup `protobuf:"group,18,opt,name=OptionalGroup,json=optionalgroup" json:"optionalgroup,omitempty"`
RequiredBool *bool `protobuf:"varint,101,req,name=required_bool,json=requiredBool" json:"required_bool,omitempty"`
RequiredEnum *FieldTestMessage_Enum `protobuf:"varint,102,req,name=required_enum,json=requiredEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum" json:"required_enum,omitempty"`
RequiredInt32 *int32 `protobuf:"varint,103,req,name=required_int32,json=requiredInt32" json:"required_int32,omitempty"`
RequiredSint32 *int32 `protobuf:"zigzag32,104,req,name=required_sint32,json=requiredSint32" json:"required_sint32,omitempty"`
RequiredUint32 *uint32 `protobuf:"varint,105,req,name=required_uint32,json=requiredUint32" json:"required_uint32,omitempty"`
RequiredInt64 *int64 `protobuf:"varint,106,req,name=required_int64,json=requiredInt64" json:"required_int64,omitempty"`
RequiredSint64 *int64 `protobuf:"zigzag64,107,req,name=required_sint64,json=requiredSint64" json:"required_sint64,omitempty"`
RequiredUint64 *uint64 `protobuf:"varint,108,req,name=required_uint64,json=requiredUint64" json:"required_uint64,omitempty"`
RequiredSfixed32 *int32 `protobuf:"fixed32,109,req,name=required_sfixed32,json=requiredSfixed32" json:"required_sfixed32,omitempty"`
RequiredFixed32 *uint32 `protobuf:"fixed32,110,req,name=required_fixed32,json=requiredFixed32" json:"required_fixed32,omitempty"`
RequiredFloat *float32 `protobuf:"fixed32,111,req,name=required_float,json=requiredFloat" json:"required_float,omitempty"`
RequiredSfixed64 *int64 `protobuf:"fixed64,112,req,name=required_sfixed64,json=requiredSfixed64" json:"required_sfixed64,omitempty"`
RequiredFixed64 *uint64 `protobuf:"fixed64,113,req,name=required_fixed64,json=requiredFixed64" json:"required_fixed64,omitempty"`
RequiredDouble *float64 `protobuf:"fixed64,114,req,name=required_double,json=requiredDouble" json:"required_double,omitempty"`
RequiredString *string `protobuf:"bytes,115,req,name=required_string,json=requiredString" json:"required_string,omitempty"`
RequiredBytes []byte `protobuf:"bytes,116,req,name=required_bytes,json=requiredBytes" json:"required_bytes,omitempty"`
Required_Message *FieldTestMessage_Message `protobuf:"bytes,117,req,name=required_Message,json=requiredMessage" json:"required_Message,omitempty"`
Requiredgroup *FieldTestMessage_RequiredGroup `protobuf:"group,118,req,name=RequiredGroup,json=requiredgroup" json:"requiredgroup,omitempty"`
RepeatedBool []bool `protobuf:"varint,201,rep,name=repeated_bool,json=repeatedBool" json:"repeated_bool,omitempty"`
RepeatedEnum []FieldTestMessage_Enum `protobuf:"varint,202,rep,name=repeated_enum,json=repeatedEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum" json:"repeated_enum,omitempty"`
RepeatedInt32 []int32 `protobuf:"varint,203,rep,name=repeated_int32,json=repeatedInt32" json:"repeated_int32,omitempty"`
RepeatedSint32 []int32 `protobuf:"zigzag32,204,rep,name=repeated_sint32,json=repeatedSint32" json:"repeated_sint32,omitempty"`
RepeatedUint32 []uint32 `protobuf:"varint,205,rep,name=repeated_uint32,json=repeatedUint32" json:"repeated_uint32,omitempty"`
RepeatedInt64 []int64 `protobuf:"varint,206,rep,name=repeated_int64,json=repeatedInt64" json:"repeated_int64,omitempty"`
RepeatedSint64 []int64 `protobuf:"zigzag64,207,rep,name=repeated_sint64,json=repeatedSint64" json:"repeated_sint64,omitempty"`
RepeatedUint64 []uint64 `protobuf:"varint,208,rep,name=repeated_uint64,json=repeatedUint64" json:"repeated_uint64,omitempty"`
RepeatedSfixed32 []int32 `protobuf:"fixed32,209,rep,name=repeated_sfixed32,json=repeatedSfixed32" json:"repeated_sfixed32,omitempty"`
RepeatedFixed32 []uint32 `protobuf:"fixed32,210,rep,name=repeated_fixed32,json=repeatedFixed32" json:"repeated_fixed32,omitempty"`
RepeatedFloat []float32 `protobuf:"fixed32,211,rep,name=repeated_float,json=repeatedFloat" json:"repeated_float,omitempty"`
RepeatedSfixed64 []int64 `protobuf:"fixed64,212,rep,name=repeated_sfixed64,json=repeatedSfixed64" json:"repeated_sfixed64,omitempty"`
RepeatedFixed64 []uint64 `protobuf:"fixed64,213,rep,name=repeated_fixed64,json=repeatedFixed64" json:"repeated_fixed64,omitempty"`
RepeatedDouble []float64 `protobuf:"fixed64,214,rep,name=repeated_double,json=repeatedDouble" json:"repeated_double,omitempty"`
RepeatedString []string `protobuf:"bytes,215,rep,name=repeated_string,json=repeatedString" json:"repeated_string,omitempty"`
RepeatedBytes [][]byte `protobuf:"bytes,216,rep,name=repeated_bytes,json=repeatedBytes" json:"repeated_bytes,omitempty"`
Repeated_Message []*FieldTestMessage_Message `protobuf:"bytes,217,rep,name=repeated_Message,json=repeatedMessage" json:"repeated_Message,omitempty"`
Repeatedgroup []*FieldTestMessage_RepeatedGroup `protobuf:"group,218,rep,name=RepeatedGroup,json=repeatedgroup" json:"repeatedgroup,omitempty"`
DefaultBool *bool `protobuf:"varint,301,opt,name=default_bool,json=defaultBool,def=1" json:"default_bool,omitempty"`
DefaultEnum *FieldTestMessage_Enum `protobuf:"varint,302,opt,name=default_enum,json=defaultEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum,def=1" json:"default_enum,omitempty"`
DefaultInt32 *int32 `protobuf:"varint,303,opt,name=default_int32,json=defaultInt32,def=1" json:"default_int32,omitempty"`
DefaultSint32 *int32 `protobuf:"zigzag32,304,opt,name=default_sint32,json=defaultSint32,def=1" json:"default_sint32,omitempty"`
DefaultUint32 *uint32 `protobuf:"varint,305,opt,name=default_uint32,json=defaultUint32,def=1" json:"default_uint32,omitempty"`
DefaultInt64 *int64 `protobuf:"varint,306,opt,name=default_int64,json=defaultInt64,def=1" json:"default_int64,omitempty"`
DefaultSint64 *int64 `protobuf:"zigzag64,307,opt,name=default_sint64,json=defaultSint64,def=1" json:"default_sint64,omitempty"`
DefaultUint64 *uint64 `protobuf:"varint,308,opt,name=default_uint64,json=defaultUint64,def=1" json:"default_uint64,omitempty"`
DefaultSfixed32 *int32 `protobuf:"fixed32,309,opt,name=default_sfixed32,json=defaultSfixed32,def=1" json:"default_sfixed32,omitempty"`
DefaultFixed32 *uint32 `protobuf:"fixed32,310,opt,name=default_fixed32,json=defaultFixed32,def=1" json:"default_fixed32,omitempty"`
DefaultFloat *float32 `protobuf:"fixed32,311,opt,name=default_float,json=defaultFloat,def=1.5" json:"default_float,omitempty"`
DefaultSfixed64 *int64 `protobuf:"fixed64,312,opt,name=default_sfixed64,json=defaultSfixed64,def=1" json:"default_sfixed64,omitempty"`
DefaultFixed64 *uint64 `protobuf:"fixed64,313,opt,name=default_fixed64,json=defaultFixed64,def=1" json:"default_fixed64,omitempty"`
DefaultDouble *float64 `protobuf:"fixed64,314,opt,name=default_double,json=defaultDouble,def=1.5" json:"default_double,omitempty"`
DefaultString *string `protobuf:"bytes,315,opt,name=default_string,json=defaultString,def=x,y" json:"default_string,omitempty"`
DefaultBytes []byte `protobuf:"bytes,316,opt,name=default_bytes,json=defaultBytes,def=x,y" json:"default_bytes,omitempty"`
DefaultFloatNeginf *float32 `protobuf:"fixed32,400,opt,name=default_float_neginf,json=defaultFloatNeginf,def=-inf" json:"default_float_neginf,omitempty"`
DefaultFloatPosinf *float32 `protobuf:"fixed32,401,opt,name=default_float_posinf,json=defaultFloatPosinf,def=inf" json:"default_float_posinf,omitempty"`
DefaultFloatNan *float32 `protobuf:"fixed32,402,opt,name=default_float_nan,json=defaultFloatNan,def=nan" json:"default_float_nan,omitempty"`
DefaultDoubleNeginf *float64 `protobuf:"fixed64,403,opt,name=default_double_neginf,json=defaultDoubleNeginf,def=-inf" json:"default_double_neginf,omitempty"`
DefaultDoublePosinf *float64 `protobuf:"fixed64,404,opt,name=default_double_posinf,json=defaultDoublePosinf,def=inf" json:"default_double_posinf,omitempty"`
DefaultDoubleNan *float64 `protobuf:"fixed64,405,opt,name=default_double_nan,json=defaultDoubleNan,def=nan" json:"default_double_nan,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
OptionalBool *bool `protobuf:"varint,1,opt,name=optional_bool,json=optionalBool" json:"optional_bool,omitempty"`
OptionalEnum *FieldTestMessage_Enum `protobuf:"varint,2,opt,name=optional_enum,json=optionalEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum" json:"optional_enum,omitempty"`
OptionalInt32 *int32 `protobuf:"varint,3,opt,name=optional_int32,json=optionalInt32" json:"optional_int32,omitempty"`
OptionalSint32 *int32 `protobuf:"zigzag32,4,opt,name=optional_sint32,json=optionalSint32" json:"optional_sint32,omitempty"`
OptionalUint32 *uint32 `protobuf:"varint,5,opt,name=optional_uint32,json=optionalUint32" json:"optional_uint32,omitempty"`
OptionalInt64 *int64 `protobuf:"varint,6,opt,name=optional_int64,json=optionalInt64" json:"optional_int64,omitempty"`
OptionalSint64 *int64 `protobuf:"zigzag64,7,opt,name=optional_sint64,json=optionalSint64" json:"optional_sint64,omitempty"`
OptionalUint64 *uint64 `protobuf:"varint,8,opt,name=optional_uint64,json=optionalUint64" json:"optional_uint64,omitempty"`
OptionalSfixed32 *int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32" json:"optional_sfixed32,omitempty"`
OptionalFixed32 *uint32 `protobuf:"fixed32,10,opt,name=optional_fixed32,json=optionalFixed32" json:"optional_fixed32,omitempty"`
OptionalFloat *float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat" json:"optional_float,omitempty"`
OptionalSfixed64 *int64 `protobuf:"fixed64,12,opt,name=optional_sfixed64,json=optionalSfixed64" json:"optional_sfixed64,omitempty"`
OptionalFixed64 *uint64 `protobuf:"fixed64,13,opt,name=optional_fixed64,json=optionalFixed64" json:"optional_fixed64,omitempty"`
OptionalDouble *float64 `protobuf:"fixed64,14,opt,name=optional_double,json=optionalDouble" json:"optional_double,omitempty"`
OptionalString *string `protobuf:"bytes,15,opt,name=optional_string,json=optionalString" json:"optional_string,omitempty"`
OptionalBytes []byte `protobuf:"bytes,16,opt,name=optional_bytes,json=optionalBytes" json:"optional_bytes,omitempty"`
Optional_Message *FieldTestMessage_Message `protobuf:"bytes,17,opt,name=optional_Message,json=optionalMessage" json:"optional_Message,omitempty"`
Optionalgroup *FieldTestMessage_OptionalGroup `protobuf:"group,18,opt,name=OptionalGroup,json=optionalgroup" json:"optionalgroup,omitempty"`
RequiredBool *bool `protobuf:"varint,101,req,name=required_bool,json=requiredBool" json:"required_bool,omitempty"`
RequiredEnum *FieldTestMessage_Enum `protobuf:"varint,102,req,name=required_enum,json=requiredEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum" json:"required_enum,omitempty"`
RequiredInt32 *int32 `protobuf:"varint,103,req,name=required_int32,json=requiredInt32" json:"required_int32,omitempty"`
RequiredSint32 *int32 `protobuf:"zigzag32,104,req,name=required_sint32,json=requiredSint32" json:"required_sint32,omitempty"`
RequiredUint32 *uint32 `protobuf:"varint,105,req,name=required_uint32,json=requiredUint32" json:"required_uint32,omitempty"`
RequiredInt64 *int64 `protobuf:"varint,106,req,name=required_int64,json=requiredInt64" json:"required_int64,omitempty"`
RequiredSint64 *int64 `protobuf:"zigzag64,107,req,name=required_sint64,json=requiredSint64" json:"required_sint64,omitempty"`
RequiredUint64 *uint64 `protobuf:"varint,108,req,name=required_uint64,json=requiredUint64" json:"required_uint64,omitempty"`
RequiredSfixed32 *int32 `protobuf:"fixed32,109,req,name=required_sfixed32,json=requiredSfixed32" json:"required_sfixed32,omitempty"`
RequiredFixed32 *uint32 `protobuf:"fixed32,110,req,name=required_fixed32,json=requiredFixed32" json:"required_fixed32,omitempty"`
RequiredFloat *float32 `protobuf:"fixed32,111,req,name=required_float,json=requiredFloat" json:"required_float,omitempty"`
RequiredSfixed64 *int64 `protobuf:"fixed64,112,req,name=required_sfixed64,json=requiredSfixed64" json:"required_sfixed64,omitempty"`
RequiredFixed64 *uint64 `protobuf:"fixed64,113,req,name=required_fixed64,json=requiredFixed64" json:"required_fixed64,omitempty"`
RequiredDouble *float64 `protobuf:"fixed64,114,req,name=required_double,json=requiredDouble" json:"required_double,omitempty"`
RequiredString *string `protobuf:"bytes,115,req,name=required_string,json=requiredString" json:"required_string,omitempty"`
RequiredBytes []byte `protobuf:"bytes,116,req,name=required_bytes,json=requiredBytes" json:"required_bytes,omitempty"`
Required_Message *FieldTestMessage_Message `protobuf:"bytes,117,req,name=required_Message,json=requiredMessage" json:"required_Message,omitempty"`
Requiredgroup *FieldTestMessage_RequiredGroup `protobuf:"group,118,req,name=RequiredGroup,json=requiredgroup" json:"requiredgroup,omitempty"`
RepeatedBool []bool `protobuf:"varint,201,rep,name=repeated_bool,json=repeatedBool" json:"repeated_bool,omitempty"`
RepeatedEnum []FieldTestMessage_Enum `protobuf:"varint,202,rep,name=repeated_enum,json=repeatedEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum" json:"repeated_enum,omitempty"`
RepeatedInt32 []int32 `protobuf:"varint,203,rep,name=repeated_int32,json=repeatedInt32" json:"repeated_int32,omitempty"`
RepeatedSint32 []int32 `protobuf:"zigzag32,204,rep,name=repeated_sint32,json=repeatedSint32" json:"repeated_sint32,omitempty"`
RepeatedUint32 []uint32 `protobuf:"varint,205,rep,name=repeated_uint32,json=repeatedUint32" json:"repeated_uint32,omitempty"`
RepeatedInt64 []int64 `protobuf:"varint,206,rep,name=repeated_int64,json=repeatedInt64" json:"repeated_int64,omitempty"`
RepeatedSint64 []int64 `protobuf:"zigzag64,207,rep,name=repeated_sint64,json=repeatedSint64" json:"repeated_sint64,omitempty"`
RepeatedUint64 []uint64 `protobuf:"varint,208,rep,name=repeated_uint64,json=repeatedUint64" json:"repeated_uint64,omitempty"`
RepeatedSfixed32 []int32 `protobuf:"fixed32,209,rep,name=repeated_sfixed32,json=repeatedSfixed32" json:"repeated_sfixed32,omitempty"`
RepeatedFixed32 []uint32 `protobuf:"fixed32,210,rep,name=repeated_fixed32,json=repeatedFixed32" json:"repeated_fixed32,omitempty"`
RepeatedFloat []float32 `protobuf:"fixed32,211,rep,name=repeated_float,json=repeatedFloat" json:"repeated_float,omitempty"`
RepeatedSfixed64 []int64 `protobuf:"fixed64,212,rep,name=repeated_sfixed64,json=repeatedSfixed64" json:"repeated_sfixed64,omitempty"`
RepeatedFixed64 []uint64 `protobuf:"fixed64,213,rep,name=repeated_fixed64,json=repeatedFixed64" json:"repeated_fixed64,omitempty"`
RepeatedDouble []float64 `protobuf:"fixed64,214,rep,name=repeated_double,json=repeatedDouble" json:"repeated_double,omitempty"`
RepeatedString []string `protobuf:"bytes,215,rep,name=repeated_string,json=repeatedString" json:"repeated_string,omitempty"`
RepeatedBytes [][]byte `protobuf:"bytes,216,rep,name=repeated_bytes,json=repeatedBytes" json:"repeated_bytes,omitempty"`
Repeated_Message []*FieldTestMessage_Message `protobuf:"bytes,217,rep,name=repeated_Message,json=repeatedMessage" json:"repeated_Message,omitempty"`
Repeatedgroup []*FieldTestMessage_RepeatedGroup `protobuf:"group,218,rep,name=RepeatedGroup,json=repeatedgroup" json:"repeatedgroup,omitempty"`
DefaultBool *bool `protobuf:"varint,301,opt,name=default_bool,json=defaultBool,def=1" json:"default_bool,omitempty"`
DefaultEnum *FieldTestMessage_Enum `protobuf:"varint,302,opt,name=default_enum,json=defaultEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum,def=1" json:"default_enum,omitempty"`
DefaultInt32 *int32 `protobuf:"varint,303,opt,name=default_int32,json=defaultInt32,def=1" json:"default_int32,omitempty"`
DefaultSint32 *int32 `protobuf:"zigzag32,304,opt,name=default_sint32,json=defaultSint32,def=1" json:"default_sint32,omitempty"`
DefaultUint32 *uint32 `protobuf:"varint,305,opt,name=default_uint32,json=defaultUint32,def=1" json:"default_uint32,omitempty"`
DefaultInt64 *int64 `protobuf:"varint,306,opt,name=default_int64,json=defaultInt64,def=1" json:"default_int64,omitempty"`
DefaultSint64 *int64 `protobuf:"zigzag64,307,opt,name=default_sint64,json=defaultSint64,def=1" json:"default_sint64,omitempty"`
DefaultUint64 *uint64 `protobuf:"varint,308,opt,name=default_uint64,json=defaultUint64,def=1" json:"default_uint64,omitempty"`
DefaultSfixed32 *int32 `protobuf:"fixed32,309,opt,name=default_sfixed32,json=defaultSfixed32,def=1" json:"default_sfixed32,omitempty"`
DefaultFixed32 *uint32 `protobuf:"fixed32,310,opt,name=default_fixed32,json=defaultFixed32,def=1" json:"default_fixed32,omitempty"`
DefaultFloat *float32 `protobuf:"fixed32,311,opt,name=default_float,json=defaultFloat,def=1.5" json:"default_float,omitempty"`
DefaultSfixed64 *int64 `protobuf:"fixed64,312,opt,name=default_sfixed64,json=defaultSfixed64,def=1" json:"default_sfixed64,omitempty"`
DefaultFixed64 *uint64 `protobuf:"fixed64,313,opt,name=default_fixed64,json=defaultFixed64,def=1" json:"default_fixed64,omitempty"`
DefaultDouble *float64 `protobuf:"fixed64,314,opt,name=default_double,json=defaultDouble,def=1.5" json:"default_double,omitempty"`
DefaultString *string `protobuf:"bytes,315,opt,name=default_string,json=defaultString,def=x,y" json:"default_string,omitempty"`
DefaultBytes []byte `protobuf:"bytes,316,opt,name=default_bytes,json=defaultBytes,def=x,y" json:"default_bytes,omitempty"`
DefaultFloatNeginf *float32 `protobuf:"fixed32,400,opt,name=default_float_neginf,json=defaultFloatNeginf,def=-inf" json:"default_float_neginf,omitempty"`
DefaultFloatPosinf *float32 `protobuf:"fixed32,401,opt,name=default_float_posinf,json=defaultFloatPosinf,def=inf" json:"default_float_posinf,omitempty"`
DefaultFloatNan *float32 `protobuf:"fixed32,402,opt,name=default_float_nan,json=defaultFloatNan,def=nan" json:"default_float_nan,omitempty"`
DefaultDoubleNeginf *float64 `protobuf:"fixed64,403,opt,name=default_double_neginf,json=defaultDoubleNeginf,def=-inf" json:"default_double_neginf,omitempty"`
DefaultDoublePosinf *float64 `protobuf:"fixed64,404,opt,name=default_double_posinf,json=defaultDoublePosinf,def=inf" json:"default_double_posinf,omitempty"`
DefaultDoubleNan *float64 `protobuf:"fixed64,405,opt,name=default_double_nan,json=defaultDoubleNan,def=nan" json:"default_double_nan,omitempty"`
MapInt32Int64 map[int32]int64 `protobuf:"bytes,500,rep,name=map_int32_int64,json=mapInt32Int64" json:"map_int32_int64,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
MapStringMessage map[string]*FieldTestMessage_Message `protobuf:"bytes,501,rep,name=map_string_message,json=mapStringMessage" json:"map_string_message,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
MapFixed64Enum map[uint64]FieldTestMessage_Enum `protobuf:"bytes,502,rep,name=map_fixed64_enum,json=mapFixed64Enum" json:"map_fixed64_enum,omitempty" protobuf_key:"fixed64,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=goproto.protoc.proto2.FieldTestMessage_Enum"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *FieldTestMessage) Reset() { *m = FieldTestMessage{} }
@ -716,6 +719,27 @@ func (m *FieldTestMessage) GetDefaultDoubleNan() float64 {
return Default_FieldTestMessage_DefaultDoubleNan
}
func (m *FieldTestMessage) GetMapInt32Int64() map[int32]int64 {
if m != nil {
return m.MapInt32Int64
}
return nil
}
func (m *FieldTestMessage) GetMapStringMessage() map[string]*FieldTestMessage_Message {
if m != nil {
return m.MapStringMessage
}
return nil
}
func (m *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum {
if m != nil {
return m.MapFixed64Enum
}
return nil
}
type FieldTestMessage_OptionalGroup struct {
OptionalGroup *string `protobuf:"bytes,19,opt,name=optional_group,json=optionalGroup" json:"optional_group,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -840,7 +864,7 @@ func (m *FieldTestMessage_Message) Reset() { *m = FieldTestMessage_Messa
func (m *FieldTestMessage_Message) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_Message) ProtoMessage() {}
func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {
return fileDescriptor_fd8a9d72b841fd68, []int{0, 3}
return fileDescriptor_fd8a9d72b841fd68, []int{0, 6}
}
func (m *FieldTestMessage_Message) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FieldTestMessage_Message.Unmarshal(m, b)
@ -867,89 +891,99 @@ func init() {
func init() { proto.RegisterFile("proto2/fields.proto", fileDescriptor_fd8a9d72b841fd68) }
var fileDescriptor_fd8a9d72b841fd68 = []byte{
// 1337 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x97, 0x59, 0x73, 0xdc, 0x44,
0x10, 0xc7, 0x19, 0x69, 0xe3, 0x63, 0xb2, 0x6b, 0xaf, 0x15, 0x52, 0x35, 0xf0, 0x40, 0x4d, 0x85,
0x23, 0x0a, 0x89, 0xd7, 0x64, 0xa3, 0x4c, 0x88, 0x79, 0x4b, 0x11, 0x53, 0x3c, 0x90, 0x80, 0x20,
0x2f, 0x0e, 0x55, 0x2e, 0xd9, 0xab, 0x15, 0x0b, 0x6b, 0x69, 0xb3, 0xab, 0x85, 0xe4, 0x5b, 0x70,
0x7e, 0x0c, 0xee, 0xfb, 0xf8, 0x02, 0xdc, 0xf7, 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0x4c, 0xd5, 0x66, 0x9f, 0x06, 0x75, 0xd3, 0x24, 0x67, 0x6f, 0xa9, 0x34, 0xe8, 0xb3, 0xeb, 0x1a,
0x26, 0xf9, 0xbd, 0x82, 0x76, 0x9c, 0xab, 0xb4, 0xf3, 0xbf, 0x01, 0x1e, 0x51, 0xc7, 0xe4, 0xff,
0x10, 0xe6, 0x8a, 0x2d, 0x65, 0x90, 0xe7, 0xdc, 0x07, 0x9c, 0x0b, 0x0e, 0xe6, 0xbd, 0x22, 0x2f,
0x42, 0xe6, 0x9e, 0x80, 0x79, 0x17, 0x20, 0xcf, 0x3a, 0xc2, 0x9c, 0x63, 0x19, 0xf3, 0xfe, 0xc5,
0xf3, 0xdb, 0x9c, 0x6d, 0x98, 0xb8, 0x4c, 0x17, 0xd5, 0xe1, 0x73, 0xe2, 0x1e, 0xda, 0x92, 0xa7,
0xcd, 0x12, 0x6d, 0x6d, 0x5f, 0x8e, 0xaf, 0x76, 0xef, 0x0a, 0x16, 0x29, 0x9c, 0x45, 0x5d, 0x72,
0xe9, 0xb1, 0xed, 0x8b, 0x59, 0x51, 0x64, 0xe3, 0xb4, 0x97, 0x15, 0xe3, 0x24, 0xcf, 0x7a, 0xc5,
0x34, 0xdb, 0x90, 0x87, 0xd8, 0xc6, 0xde, 0xfe, 0x00, 0x7f, 0xdb, 0x5b, 0xcf, 0xd2, 0x7c, 0x3d,
0x2b, 0x36, 0xca, 0x74, 0x56, 0x0e, 0x92, 0x32, 0xc1, 0x70, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff,
0xff, 0xd7, 0x14, 0x76, 0x33, 0xeb, 0x0f, 0x00, 0x00,
// 1496 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x98, 0xc9, 0x72, 0xdb, 0x46,
0x13, 0xc7, 0x3f, 0x00, 0xd4, 0x36, 0x16, 0x25, 0x6a, 0x64, 0x57, 0xcd, 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0x11, 0x0b, 0xf3, 0x2e, 0x42,
0x9e, 0x71, 0xf7, 0xb7, 0x4e, 0x34, 0xcc, 0xfb, 0x13, 0x8f, 0x3e, 0x7d, 0x2c, 0x60, 0xe2, 0x23,
0x84, 0x56, 0x7f, 0x23, 0xda, 0x20, 0xde, 0xed, 0x64, 0x57, 0xfc, 0x37, 0x62, 0x26, 0x82, 0x8f,
0xf4, 0x28, 0x99, 0xb9, 0x1b, 0x0f, 0xa6, 0x89, 0xf8, 0xe7, 0x83, 0x17, 0xe1, 0x97, 0xb6, 0x7b,
0xc9, 0x39, 0x9e, 0x93, 0x63, 0x7b, 0x4e, 0xdf, 0x2c, 0xb2, 0x80, 0x45, 0x36, 0xcd, 0x22, 0x87,
0x38, 0x32, 0x0d, 0xd7, 0x8c, 0xac, 0xee, 0xf1, 0x3b, 0x98, 0x9e, 0xb3, 0xe8, 0xb9, 0x61, 0x7a,
0x1e, 0xf4, 0x69, 0xd2, 0x30, 0x5c, 0x20, 0x73, 0xf2, 0xd2, 0x89, 0xff, 0x93, 0x9a, 0x38, 0xd1,
0xe6, 0x49, 0xed, 0xc6, 0x66, 0x74, 0xad, 0xf1, 0x3f, 0x3a, 0x47, 0xe0, 0xbc, 0x6b, 0x38, 0x1b,
0x57, 0x6e, 0x5c, 0xee, 0x65, 0x59, 0x6f, 0x90, 0x34, 0x7b, 0xd9, 0x20, 0x4e, 0x7b, 0xcd, 0x6c,
0xdc, 0x5b, 0x17, 0x16, 0xeb, 0x3b, 0xc3, 0x0e, 0x7e, 0xda, 0x59, 0xeb, 0x25, 0xe9, 0x5a, 0x2f,
0x5b, 0xcf, 0x93, 0x49, 0xde, 0x89, 0xf3, 0x18, 0xc3, 0xad, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff,
0xd8, 0xe8, 0xaa, 0xfc, 0x4f, 0x12, 0x00, 0x00,
}

View File

@ -96,6 +96,10 @@ message FieldTestMessage {
optional double default_double_posinf = 404 [default=inf];
optional double default_double_nan = 405 [default=nan];
map<int32, int64> map_int32_int64 = 500;
map<string,Message> map_string_message = 501;
map<fixed64,Enum> map_fixed64_enum = 502;
enum Enum {
ZERO = 0;
ONE = 1;

View File

@ -34,26 +34,29 @@ func (FieldTestMessage_Enum) EnumDescriptor() ([]byte, []int) {
}
type FieldTestMessage struct {
OptionalBool string `protobuf:"bytes,1,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"`
OptionalEnum FieldTestMessage_Enum `protobuf:"varint,2,opt,name=optional_enum,json=optionalEnum,proto3,enum=goproto.protoc.proto3.FieldTestMessage_Enum" json:"optional_enum,omitempty"`
OptionalInt32 int32 `protobuf:"varint,3,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"`
OptionalSint32 int32 `protobuf:"zigzag32,4,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"`
OptionalUint32 uint32 `protobuf:"varint,5,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"`
OptionalInt64 int64 `protobuf:"varint,6,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"`
OptionalSint64 int64 `protobuf:"zigzag64,7,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"`
OptionalUint64 uint64 `protobuf:"varint,8,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"`
OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"`
OptionalFixed32 uint32 `protobuf:"fixed32,10,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"`
OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"`
OptionalSfixed64 int64 `protobuf:"fixed64,12,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"`
OptionalFixed64 uint64 `protobuf:"fixed64,13,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"`
OptionalDouble float64 `protobuf:"fixed64,14,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"`
OptionalString string `protobuf:"bytes,15,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"`
OptionalBytes []byte `protobuf:"bytes,16,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"`
Optional_Message *FieldTestMessage_Message `protobuf:"bytes,17,opt,name=optional_Message,json=optionalMessage,proto3" json:"optional_Message,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
OptionalBool string `protobuf:"bytes,1,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"`
OptionalEnum FieldTestMessage_Enum `protobuf:"varint,2,opt,name=optional_enum,json=optionalEnum,proto3,enum=goproto.protoc.proto3.FieldTestMessage_Enum" json:"optional_enum,omitempty"`
OptionalInt32 int32 `protobuf:"varint,3,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"`
OptionalSint32 int32 `protobuf:"zigzag32,4,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"`
OptionalUint32 uint32 `protobuf:"varint,5,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"`
OptionalInt64 int64 `protobuf:"varint,6,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"`
OptionalSint64 int64 `protobuf:"zigzag64,7,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"`
OptionalUint64 uint64 `protobuf:"varint,8,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"`
OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"`
OptionalFixed32 uint32 `protobuf:"fixed32,10,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"`
OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"`
OptionalSfixed64 int64 `protobuf:"fixed64,12,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"`
OptionalFixed64 uint64 `protobuf:"fixed64,13,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"`
OptionalDouble float64 `protobuf:"fixed64,14,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"`
OptionalString string `protobuf:"bytes,15,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"`
OptionalBytes []byte `protobuf:"bytes,16,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"`
Optional_Message *FieldTestMessage_Message `protobuf:"bytes,17,opt,name=optional_Message,json=optionalMessage,proto3" json:"optional_Message,omitempty"`
MapInt32Int64 map[int32]int64 `protobuf:"bytes,500,rep,name=map_int32_int64,json=mapInt32Int64,proto3" json:"map_int32_int64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
MapStringMessage map[string]*FieldTestMessage_Message `protobuf:"bytes,501,rep,name=map_string_message,json=mapStringMessage,proto3" json:"map_string_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
MapFixed64Enum map[uint64]FieldTestMessage_Enum `protobuf:"bytes,502,rep,name=map_fixed64_enum,json=mapFixed64Enum,proto3" json:"map_fixed64_enum,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=goproto.protoc.proto3.FieldTestMessage_Enum"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *FieldTestMessage) Reset() { *m = FieldTestMessage{} }
@ -199,6 +202,27 @@ func (m *FieldTestMessage) GetOptional_Message() *FieldTestMessage_Message {
return nil
}
func (m *FieldTestMessage) GetMapInt32Int64() map[int32]int64 {
if m != nil {
return m.MapInt32Int64
}
return nil
}
func (m *FieldTestMessage) GetMapStringMessage() map[string]*FieldTestMessage_Message {
if m != nil {
return m.MapStringMessage
}
return nil
}
func (m *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum {
if m != nil {
return m.MapFixed64Enum
}
return nil
}
type FieldTestMessage_Message struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -209,7 +233,7 @@ func (m *FieldTestMessage_Message) Reset() { *m = FieldTestMessage_Messa
func (m *FieldTestMessage_Message) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_Message) ProtoMessage() {}
func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {
return fileDescriptor_f1e3ea068187307c, []int{0, 0}
return fileDescriptor_f1e3ea068187307c, []int{0, 3}
}
func (m *FieldTestMessage_Message) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FieldTestMessage_Message.Unmarshal(m, b)
@ -236,33 +260,43 @@ func init() {
func init() { proto.RegisterFile("proto3/fields.proto", fileDescriptor_f1e3ea068187307c) }
var fileDescriptor_f1e3ea068187307c = []byte{
// 440 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6b, 0xdb, 0x40,
0x10, 0xc5, 0x3b, 0x89, 0x63, 0xc7, 0x1b, 0xff, 0x91, 0xb7, 0x14, 0x96, 0x9e, 0x96, 0x94, 0xd2,
0x2d, 0x6d, 0x24, 0xb0, 0x84, 0xa0, 0xf4, 0x66, 0x1a, 0x43, 0x0f, 0xa5, 0x54, 0x6d, 0x2f, 0xbe,
0x04, 0xc9, 0x5a, 0x2f, 0x02, 0x59, 0x13, 0xac, 0x15, 0xb4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 0xff, 0x03, 0x00, 0x00, 0xff, 0xff,
0xa9, 0x42, 0xe7, 0xab, 0xb9, 0x03, 0x00, 0x00,
// 596 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4b, 0x8f, 0xd3, 0x3c,
0x18, 0x85, 0x3f, 0x4f, 0x7a, 0x99, 0xba, 0xb7, 0xd4, 0xf3, 0x8d, 0x64, 0xcd, 0xca, 0x1a, 0x84,
0x30, 0x82, 0x49, 0xa5, 0x36, 0x8a, 0x60, 0x46, 0x48, 0xa8, 0xa2, 0x95, 0x58, 0x20, 0x44, 0x80,
0x4d, 0x37, 0x55, 0xda, 0xba, 0x51, 0x44, 0x12, 0x57, 0x8d, 0x83, 0xe8, 0x4f, 0xe2, 0xff, 0x01,
0x6b, 0x14, 0x3b, 0xcd, 0xad, 0x5d, 0x4c, 0x59, 0xd9, 0x3e, 0x3d, 0x7d, 0x9f, 0x1c, 0xfb, 0xb5,
0xe1, 0xd5, 0x76, 0xc7, 0x05, 0x1f, 0x0f, 0x37, 0x1e, 0xf3, 0xd7, 0x91, 0x21, 0x57, 0xe8, 0xda,
0xe5, 0x72, 0xa2, 0x96, 0x2b, 0x35, 0x8c, 0x6f, 0x7f, 0xb6, 0xa1, 0x3e, 0x4b, 0x7c, 0x5f, 0x58,
0x24, 0x3e, 0xb0, 0x28, 0x72, 0x5c, 0x86, 0x9e, 0xc0, 0x2e, 0xdf, 0x0a, 0x8f, 0x87, 0x8e, 0xbf,
0x58, 0x72, 0xee, 0x63, 0x40, 0x00, 0x6d, 0xd9, 0x9d, 0x83, 0x38, 0xe1, 0xdc, 0x47, 0x9f, 0x0a,
0x26, 0x16, 0xc6, 0x01, 0xbe, 0x20, 0x80, 0xf6, 0x46, 0x2f, 0x8d, 0x93, 0x20, 0xa3, 0x0a, 0x31,
0xa6, 0x61, 0x1c, 0xe4, 0x25, 0x93, 0x15, 0x7a,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0x3f, 0xea, 0xff, 0x4d, 0x1e, 0xe6, 0xaf,
0x5d, 0xce, 0x5d, 0x9f, 0x19, 0x2e, 0xf7, 0x9d, 0xd0, 0x35, 0xf8, 0xce, 0x1d, 0xca, 0xca, 0xc3,
0x55, 0xb0, 0x56, 0xb3, 0xd5, 0x9d, 0xcb, 0xc2, 0x3b, 0x97, 0x0f, 0x05, 0x8b, 0xc4, 0xda, 0x11,
0x8e, 0x92, 0xc7, 0xcb, 0x86, 0x1a, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xd2, 0xfc, 0xf5,
0x1d, 0x06, 0x00, 0x00,
}

View File

@ -27,6 +27,10 @@ message FieldTestMessage {
bytes optional_bytes = 16;
Message optional_Message = 17;
map<int32, int64> map_int32_int64 = 500;
map<string,Message> map_string_message = 501;
map<fixed64,Enum> map_fixed64_enum = 502;
enum Enum { ZERO = 0; }
message Message {}
}

View File

@ -400,6 +400,9 @@ func newFile(gen *Plugin, p *descpb.FileDescriptorProto, packageName GoPackageNa
for i, edescs := 0, desc.Enums(); i < edescs.Len(); i++ {
f.Enums = append(f.Enums, newEnum(gen, f, nil, edescs.Get(i)))
}
for _, message := range f.Messages {
message.init(gen)
}
return f, nil
}
@ -507,6 +510,20 @@ func newMessage(gen *Plugin, f *File, parent *Message, desc protoreflect.Message
return message, nil
}
func (message *Message) init(gen *Plugin) error {
for _, child := range message.Messages {
if err := child.init(gen); err != nil {
return err
}
}
for _, field := range message.Fields {
if err := field.init(gen); err != nil {
return err
}
}
return nil
}
// A Field describes a message field.
type Field struct {
Desc protoreflect.FieldDescriptor
@ -530,23 +547,28 @@ func newField(gen *Plugin, f *File, message *Message, desc protoreflect.FieldDes
},
Path: pathAppend(message.Path, messageFieldField, int32(desc.Index())),
}
return field, nil
}
func (field *Field) init(gen *Plugin) error {
desc := field.Desc
switch desc.Kind() {
case protoreflect.MessageKind, protoreflect.GroupKind:
mname := desc.MessageType().FullName()
message, ok := gen.messagesByName[mname]
if !ok {
return nil, fmt.Errorf("field %v: no descriptor for type %v", desc.FullName(), mname)
return fmt.Errorf("field %v: no descriptor for type %v", desc.FullName(), mname)
}
field.MessageType = message
case protoreflect.EnumKind:
ename := desc.EnumType().FullName()
ename := field.Desc.EnumType().FullName()
enum, ok := gen.enumsByName[ename]
if !ok {
return nil, fmt.Errorf("field %v: no descriptor for enum %v", desc.FullName(), ename)
return fmt.Errorf("field %v: no descriptor for enum %v", desc.FullName(), ename)
}
field.EnumType = enum
}
return field, nil
return nil
}
// An Enum describes an enum.