Merge pull request #54 from moul/dev/proullon/gotype
fix (gotype helper): when leading pkg is empty string, remove leading dot
This commit is contained in:
commit
a4fbdd0369
@ -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…
x
Reference in New Issue
Block a user