fix (gotype helper): when leading pkg is empty string, remove leading dot
This commit is contained in:
parent
7393098e01
commit
263cb87b9c
@ -147,10 +147,13 @@ func goType(pkg string, f *descriptor.FieldDescriptorProto) string {
|
|||||||
}
|
}
|
||||||
return "string"
|
return "string"
|
||||||
case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
|
case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
|
||||||
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
|
if pkg != "" {
|
||||||
return fmt.Sprintf("[]*%s.%s", pkg, shortType(*f.TypeName))
|
pkg = pkg + "."
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("*%s.%s", pkg, shortType(*f.TypeName))
|
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
|
||||||
|
return fmt.Sprintf("[]*%s%s", pkg, shortType(*f.TypeName))
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("*%s%s", pkg, shortType(*f.TypeName))
|
||||||
case descriptor.FieldDescriptorProto_TYPE_BYTES:
|
case descriptor.FieldDescriptorProto_TYPE_BYTES:
|
||||||
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
|
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
|
||||||
return "[]byte"
|
return "[]byte"
|
||||||
|
Loading…
Reference in New Issue
Block a user