Merge pull request #67 from moul/vgheri/int32-fix

Fixes #5
This commit is contained in:
Valerio Gheri 2017-06-09 11:59:07 +02:00 committed by GitHub
commit 8a25e9ba06

View File

@ -185,6 +185,11 @@ func goType(pkg string, f *descriptor.FieldDescriptorProto) string {
} }
return "uint64" return "uint64"
case descriptor.FieldDescriptorProto_TYPE_INT32: case descriptor.FieldDescriptorProto_TYPE_INT32:
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
return "[]int32"
}
return "int32"
case descriptor.FieldDescriptorProto_TYPE_UINT32:
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED { if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
return "[]uint32" return "[]uint32"
} }
@ -212,11 +217,6 @@ func goType(pkg string, f *descriptor.FieldDescriptorProto) string {
return "[]byte" return "[]byte"
} }
return "byte" return "byte"
case descriptor.FieldDescriptorProto_TYPE_UINT32:
if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {
return "[]uint32"
}
return "uint32"
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: