From c52b282d96a37310c422ed1541c32996c3ccf6bc Mon Sep 17 00:00:00 2001 From: Pierre Roullon Date: Thu, 22 Jun 2017 13:40:29 +0200 Subject: [PATCH] fix (helper): fix goType enum case --- helpers/helpers.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/helpers/helpers.go b/helpers/helpers.go index c5a75ec..2f8cdcb 100644 --- a/helpers/helpers.go +++ b/helpers/helpers.go @@ -233,6 +233,9 @@ func haskellType(pkg string, f *descriptor.FieldDescriptorProto) string { } func goType(pkg string, f *descriptor.FieldDescriptorProto) string { + if pkg != "" { + pkg = pkg + "." + } switch *f.Type { case descriptor.FieldDescriptorProto_TYPE_DOUBLE: if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED { @@ -275,9 +278,6 @@ func goType(pkg string, f *descriptor.FieldDescriptorProto) string { } return "string" case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if pkg != "" { - pkg = pkg + "." - } if *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED { return fmt.Sprintf("[]*%s%s", pkg, shortType(*f.TypeName)) } @@ -288,7 +288,7 @@ func goType(pkg string, f *descriptor.FieldDescriptorProto) string { } return "byte" case descriptor.FieldDescriptorProto_TYPE_ENUM: - return fmt.Sprintf("*%s.%s", pkg, shortType(*f.TypeName)) + return fmt.Sprintf("*%s%s", pkg, shortType(*f.TypeName)) default: return "interface{}" }