fix (helper): fix goType enum case

This commit is contained in:
Pierre Roullon 2017-06-22 13:40:29 +02:00 committed by Pierre Roullon
parent d454efa152
commit c52b282d96

View File

@ -233,6 +233,9 @@ func haskellType(pkg string, f *descriptor.FieldDescriptorProto) string {
} }
func goType(pkg string, f *descriptor.FieldDescriptorProto) string { func goType(pkg string, f *descriptor.FieldDescriptorProto) string {
if pkg != "" {
pkg = pkg + "."
}
switch *f.Type { switch *f.Type {
case descriptor.FieldDescriptorProto_TYPE_DOUBLE: case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED { if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
@ -275,9 +278,6 @@ func goType(pkg string, f *descriptor.FieldDescriptorProto) string {
} }
return "string" return "string"
case descriptor.FieldDescriptorProto_TYPE_MESSAGE: case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
if pkg != "" {
pkg = pkg + "."
}
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED { 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))
} }
@ -288,7 +288,7 @@ func goType(pkg string, f *descriptor.FieldDescriptorProto) string {
} }
return "byte" return "byte"
case descriptor.FieldDescriptorProto_TYPE_ENUM: case descriptor.FieldDescriptorProto_TYPE_ENUM:
return fmt.Sprintf("*%s.%s", pkg, shortType(*f.TypeName)) return fmt.Sprintf("*%s%s", pkg, shortType(*f.TypeName))
default: default:
return "interface{}" return "interface{}"
} }