fix for issue 312
diff --git a/plugin/gostring/gostring.go b/plugin/gostring/gostring.go
index 024c9f0..ceccbcf 100644
--- a/plugin/gostring/gostring.go
+++ b/plugin/gostring/gostring.go
@@ -98,11 +98,12 @@
 
 import (
 	"fmt"
-	"github.com/gogo/protobuf/gogoproto"
-	"github.com/gogo/protobuf/protoc-gen-gogo/generator"
 	"os"
 	"strconv"
 	"strings"
+
+	"github.com/gogo/protobuf/gogoproto"
+	"github.com/gogo/protobuf/protoc-gen-gogo/generator"
 )
 
 type gostring struct {
@@ -246,7 +247,7 @@
 				if field.IsEnum() {
 					if nullable && !repeated && !proto3 {
 						goTyp, _ := p.GoType(message, field)
-						p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, packageName, ".", generator.GoTypeToName(goTyp), `"`, `) + ",\n")`)
+						p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, generator.GoTypeToName(goTyp), `"`, `) + ",\n")`)
 					} else {
 						p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`)
 					}
diff --git a/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go b/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go
index 4f798d9..517a5bc 100644
--- a/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go
+++ b/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go
@@ -199,10 +199,10 @@
 		s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n")
 	}
 	if this.Label != nil {
-		s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "descriptor.FieldDescriptorProto_Label")+",\n")
+		s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "FieldDescriptorProto_Label")+",\n")
 	}
 	if this.Type != nil {
-		s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "descriptor.FieldDescriptorProto_Type")+",\n")
+		s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "FieldDescriptorProto_Type")+",\n")
 	}
 	if this.TypeName != nil {
 		s = append(s, "TypeName: "+valueToGoStringDescriptor(this.TypeName, "string")+",\n")
@@ -361,7 +361,7 @@
 		s = append(s, "JavaStringCheckUtf8: "+valueToGoStringDescriptor(this.JavaStringCheckUtf8, "bool")+",\n")
 	}
 	if this.OptimizeFor != nil {
-		s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "descriptor.FileOptions_OptimizeMode")+",\n")
+		s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "FileOptions_OptimizeMode")+",\n")
 	}
 	if this.GoPackage != nil {
 		s = append(s, "GoPackage: "+valueToGoStringDescriptor(this.GoPackage, "string")+",\n")
@@ -438,13 +438,13 @@
 	s := make([]string, 0, 11)
 	s = append(s, "&descriptor.FieldOptions{")
 	if this.Ctype != nil {
-		s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "descriptor.FieldOptions_CType")+",\n")
+		s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "FieldOptions_CType")+",\n")
 	}
 	if this.Packed != nil {
 		s = append(s, "Packed: "+valueToGoStringDescriptor(this.Packed, "bool")+",\n")
 	}
 	if this.Jstype != nil {
-		s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "descriptor.FieldOptions_JSType")+",\n")
+		s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "FieldOptions_JSType")+",\n")
 	}
 	if this.Lazy != nil {
 		s = append(s, "Lazy: "+valueToGoStringDescriptor(this.Lazy, "bool")+",\n")
@@ -551,7 +551,7 @@
 		s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n")
 	}
 	if this.IdempotencyLevel != nil {
-		s = append(s, "IdempotencyLevel: "+valueToGoStringDescriptor(this.IdempotencyLevel, "descriptor.MethodOptions_IdempotencyLevel")+",\n")
+		s = append(s, "IdempotencyLevel: "+valueToGoStringDescriptor(this.IdempotencyLevel, "MethodOptions_IdempotencyLevel")+",\n")
 	}
 	if this.UninterpretedOption != nil {
 		s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n")
diff --git a/test/combos/both/thetest.pb.go b/test/combos/both/thetest.pb.go
index a03efb2..47205b1 100644
--- a/test/combos/both/thetest.pb.go
+++ b/test/combos/both/thetest.pb.go
@@ -19507,13 +19507,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19570,13 +19570,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19591,13 +19591,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19612,13 +19612,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19689,7 +19689,7 @@
 		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "int64")+",\n")
 	}
 	if this.EnumField != nil {
-		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.NNM != nil {
 		s = append(s, "NNM: "+fmt.Sprintf("%#v", this.NNM)+",\n")
@@ -19746,7 +19746,7 @@
 		s = append(s, "A: "+fmt.Sprintf("%#v", this.A)+",\n")
 	}
 	if this.B != nil {
-		s = append(s, "B: "+valueToGoStringThetest(this.B, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "B: "+valueToGoStringThetest(this.B, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.C != nil {
 		s = append(s, "C: "+fmt.Sprintf("%#v", this.C)+",\n")
@@ -20062,7 +20062,7 @@
 	s := make([]string, 0, 6)
 	s = append(s, "&test.CustomNameEnum{")
 	if this.FieldA != nil {
-		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "test.TheTestEnum")+",\n")
+		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "TheTestEnum")+",\n")
 	}
 	if this.FieldB != nil {
 		s = append(s, "FieldB: "+fmt.Sprintf("%#v", this.FieldB)+",\n")
diff --git a/test/combos/marshaler/thetest.pb.go b/test/combos/marshaler/thetest.pb.go
index 0eda5e5..02bc2ea 100644
--- a/test/combos/marshaler/thetest.pb.go
+++ b/test/combos/marshaler/thetest.pb.go
@@ -19505,13 +19505,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19568,13 +19568,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19589,13 +19589,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19610,13 +19610,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19687,7 +19687,7 @@
 		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "int64")+",\n")
 	}
 	if this.EnumField != nil {
-		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.NNM != nil {
 		s = append(s, "NNM: "+fmt.Sprintf("%#v", this.NNM)+",\n")
@@ -19744,7 +19744,7 @@
 		s = append(s, "A: "+fmt.Sprintf("%#v", this.A)+",\n")
 	}
 	if this.B != nil {
-		s = append(s, "B: "+valueToGoStringThetest(this.B, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "B: "+valueToGoStringThetest(this.B, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.C != nil {
 		s = append(s, "C: "+fmt.Sprintf("%#v", this.C)+",\n")
@@ -20060,7 +20060,7 @@
 	s := make([]string, 0, 6)
 	s = append(s, "&test.CustomNameEnum{")
 	if this.FieldA != nil {
-		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "test.TheTestEnum")+",\n")
+		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "TheTestEnum")+",\n")
 	}
 	if this.FieldB != nil {
 		s = append(s, "FieldB: "+fmt.Sprintf("%#v", this.FieldB)+",\n")
diff --git a/test/combos/unmarshaler/thetest.pb.go b/test/combos/unmarshaler/thetest.pb.go
index c98722a..1f31f0e 100644
--- a/test/combos/unmarshaler/thetest.pb.go
+++ b/test/combos/unmarshaler/thetest.pb.go
@@ -19507,13 +19507,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19570,13 +19570,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19591,13 +19591,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19612,13 +19612,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19689,7 +19689,7 @@
 		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "int64")+",\n")
 	}
 	if this.EnumField != nil {
-		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.NNM != nil {
 		s = append(s, "NNM: "+fmt.Sprintf("%#v", this.NNM)+",\n")
@@ -19746,7 +19746,7 @@
 		s = append(s, "A: "+fmt.Sprintf("%#v", this.A)+",\n")
 	}
 	if this.B != nil {
-		s = append(s, "B: "+valueToGoStringThetest(this.B, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "B: "+valueToGoStringThetest(this.B, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.C != nil {
 		s = append(s, "C: "+fmt.Sprintf("%#v", this.C)+",\n")
@@ -20062,7 +20062,7 @@
 	s := make([]string, 0, 6)
 	s = append(s, "&test.CustomNameEnum{")
 	if this.FieldA != nil {
-		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "test.TheTestEnum")+",\n")
+		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "TheTestEnum")+",\n")
 	}
 	if this.FieldB != nil {
 		s = append(s, "FieldB: "+fmt.Sprintf("%#v", this.FieldB)+",\n")
diff --git a/test/combos/unsafeboth/thetest.pb.go b/test/combos/unsafeboth/thetest.pb.go
index 00ba5db..4200fcc 100644
--- a/test/combos/unsafeboth/thetest.pb.go
+++ b/test/combos/unsafeboth/thetest.pb.go
@@ -19510,13 +19510,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19573,13 +19573,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19594,13 +19594,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19615,13 +19615,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19692,7 +19692,7 @@
 		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "int64")+",\n")
 	}
 	if this.EnumField != nil {
-		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.NNM != nil {
 		s = append(s, "NNM: "+fmt.Sprintf("%#v", this.NNM)+",\n")
@@ -19749,7 +19749,7 @@
 		s = append(s, "A: "+fmt.Sprintf("%#v", this.A)+",\n")
 	}
 	if this.B != nil {
-		s = append(s, "B: "+valueToGoStringThetest(this.B, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "B: "+valueToGoStringThetest(this.B, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.C != nil {
 		s = append(s, "C: "+fmt.Sprintf("%#v", this.C)+",\n")
@@ -20065,7 +20065,7 @@
 	s := make([]string, 0, 6)
 	s = append(s, "&test.CustomNameEnum{")
 	if this.FieldA != nil {
-		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "test.TheTestEnum")+",\n")
+		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "TheTestEnum")+",\n")
 	}
 	if this.FieldB != nil {
 		s = append(s, "FieldB: "+fmt.Sprintf("%#v", this.FieldB)+",\n")
diff --git a/test/combos/unsafemarshaler/thetest.pb.go b/test/combos/unsafemarshaler/thetest.pb.go
index 0243d4d..b7d797e 100644
--- a/test/combos/unsafemarshaler/thetest.pb.go
+++ b/test/combos/unsafemarshaler/thetest.pb.go
@@ -19507,13 +19507,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19570,13 +19570,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19591,13 +19591,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19612,13 +19612,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19689,7 +19689,7 @@
 		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "int64")+",\n")
 	}
 	if this.EnumField != nil {
-		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.NNM != nil {
 		s = append(s, "NNM: "+fmt.Sprintf("%#v", this.NNM)+",\n")
@@ -19746,7 +19746,7 @@
 		s = append(s, "A: "+fmt.Sprintf("%#v", this.A)+",\n")
 	}
 	if this.B != nil {
-		s = append(s, "B: "+valueToGoStringThetest(this.B, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "B: "+valueToGoStringThetest(this.B, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.C != nil {
 		s = append(s, "C: "+fmt.Sprintf("%#v", this.C)+",\n")
@@ -20062,7 +20062,7 @@
 	s := make([]string, 0, 6)
 	s = append(s, "&test.CustomNameEnum{")
 	if this.FieldA != nil {
-		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "test.TheTestEnum")+",\n")
+		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "TheTestEnum")+",\n")
 	}
 	if this.FieldB != nil {
 		s = append(s, "FieldB: "+fmt.Sprintf("%#v", this.FieldB)+",\n")
diff --git a/test/combos/unsafeunmarshaler/thetest.pb.go b/test/combos/unsafeunmarshaler/thetest.pb.go
index ab81b22..e07f4e9 100644
--- a/test/combos/unsafeunmarshaler/thetest.pb.go
+++ b/test/combos/unsafeunmarshaler/thetest.pb.go
@@ -19508,13 +19508,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19571,13 +19571,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19592,13 +19592,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19613,13 +19613,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19690,7 +19690,7 @@
 		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "int64")+",\n")
 	}
 	if this.EnumField != nil {
-		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.NNM != nil {
 		s = append(s, "NNM: "+fmt.Sprintf("%#v", this.NNM)+",\n")
@@ -19747,7 +19747,7 @@
 		s = append(s, "A: "+fmt.Sprintf("%#v", this.A)+",\n")
 	}
 	if this.B != nil {
-		s = append(s, "B: "+valueToGoStringThetest(this.B, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "B: "+valueToGoStringThetest(this.B, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.C != nil {
 		s = append(s, "C: "+fmt.Sprintf("%#v", this.C)+",\n")
@@ -20063,7 +20063,7 @@
 	s := make([]string, 0, 6)
 	s = append(s, "&test.CustomNameEnum{")
 	if this.FieldA != nil {
-		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "test.TheTestEnum")+",\n")
+		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "TheTestEnum")+",\n")
 	}
 	if this.FieldB != nil {
 		s = append(s, "FieldB: "+fmt.Sprintf("%#v", this.FieldB)+",\n")
diff --git a/test/issue312/Makefile b/test/issue312/Makefile
index d90cdcf..db17d4a 100644
--- a/test/issue312/Makefile
+++ b/test/issue312/Makefile
@@ -1,4 +1,4 @@
 regenerate:
 	protoc --proto_path=.:$(GOPATH)/src/:$(GOPATH)/src/github.com/gogo/protobuf/protobuf/ \
 	--gogo_out=. issue312.proto 
-	$(MAKE) -C events $@
+	(cd events && make regenerate)
diff --git a/test/issue312/events/Makefile b/test/issue312/events/Makefile
index 44ca807..fc6be53 100644
--- a/test/issue312/events/Makefile
+++ b/test/issue312/events/Makefile
@@ -1,3 +1,4 @@
 regenerate:
+	go install github.com/gogo/protobuf/protoc-gen-gogo
 	protoc --proto_path=.:$(GOPATH)/src/:$(GOPATH)/src/github.com/gogo/protobuf/protobuf/ \
 	--gogo_out=. events.proto 
diff --git a/test/issue312/events/events.pb.go b/test/issue312/events/events.pb.go
index f623b88..9bb0b58 100644
--- a/test/issue312/events/events.pb.go
+++ b/test/issue312/events/events.pb.go
@@ -8,7 +8,7 @@
 	events.proto
 
 It has these top-level messages:
-	Event
+	Subtype
 */
 package events
 
@@ -34,34 +34,17 @@
 // proto package needs to be updated.
 const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
 
-type Event struct {
-	Subtype          *Event_Subtype `protobuf:"bytes,2,opt,name=subtype" json:"subtype,omitempty"`
-	XXX_unrecognized []byte         `json:"-"`
-}
-
-func (m *Event) Reset()                    { *m = Event{} }
-func (m *Event) String() string            { return proto.CompactTextString(m) }
-func (*Event) ProtoMessage()               {}
-func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorEvents, []int{0} }
-
-func (m *Event) GetSubtype() *Event_Subtype {
-	if m != nil {
-		return m.Subtype
-	}
-	return nil
-}
-
-type Event_Subtype struct {
-	State            *issue312.TaskState `protobuf:"varint,4,req,name=state,enum=issue312.TaskState" json:"state,omitempty"`
+type Subtype struct {
+	State            *issue312.TaskState `protobuf:"varint,4,opt,name=state,enum=issue312.TaskState" json:"state,omitempty"`
 	XXX_unrecognized []byte              `json:"-"`
 }
 
-func (m *Event_Subtype) Reset()                    { *m = Event_Subtype{} }
-func (m *Event_Subtype) String() string            { return proto.CompactTextString(m) }
-func (*Event_Subtype) ProtoMessage()               {}
-func (*Event_Subtype) Descriptor() ([]byte, []int) { return fileDescriptorEvents, []int{0, 0} }
+func (m *Subtype) Reset()                    { *m = Subtype{} }
+func (m *Subtype) String() string            { return proto.CompactTextString(m) }
+func (*Subtype) ProtoMessage()               {}
+func (*Subtype) Descriptor() ([]byte, []int) { return fileDescriptorEvents, []int{0} }
 
-func (m *Event_Subtype) GetState() issue312.TaskState {
+func (m *Subtype) GetState() issue312.TaskState {
 	if m != nil && m.State != nil {
 		return *m.State
 	}
@@ -69,10 +52,9 @@
 }
 
 func init() {
-	proto.RegisterType((*Event)(nil), "issue312.events.Event")
-	proto.RegisterType((*Event_Subtype)(nil), "issue312.events.Event.Subtype")
+	proto.RegisterType((*Subtype)(nil), "issue312.events.Subtype")
 }
-func (this *Event) Equal(that interface{}) bool {
+func (this *Subtype) Equal(that interface{}) bool {
 	if that == nil {
 		if this == nil {
 			return true
@@ -80,42 +62,9 @@
 		return false
 	}
 
-	that1, ok := that.(*Event)
+	that1, ok := that.(*Subtype)
 	if !ok {
-		that2, ok := that.(Event)
-		if ok {
-			that1 = &that2
-		} else {
-			return false
-		}
-	}
-	if that1 == nil {
-		if this == nil {
-			return true
-		}
-		return false
-	} else if this == nil {
-		return false
-	}
-	if !this.Subtype.Equal(that1.Subtype) {
-		return false
-	}
-	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
-		return false
-	}
-	return true
-}
-func (this *Event_Subtype) Equal(that interface{}) bool {
-	if that == nil {
-		if this == nil {
-			return true
-		}
-		return false
-	}
-
-	that1, ok := that.(*Event_Subtype)
-	if !ok {
-		that2, ok := that.(Event_Subtype)
+		that2, ok := that.(Subtype)
 		if ok {
 			that1 = &that2
 		} else {
@@ -144,29 +93,14 @@
 	}
 	return true
 }
-func (this *Event) GoString() string {
+func (this *Subtype) GoString() string {
 	if this == nil {
 		return "nil"
 	}
 	s := make([]string, 0, 5)
-	s = append(s, "&events.Event{")
-	if this.Subtype != nil {
-		s = append(s, "Subtype: "+fmt.Sprintf("%#v", this.Subtype)+",\n")
-	}
-	if this.XXX_unrecognized != nil {
-		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
-	}
-	s = append(s, "}")
-	return strings.Join(s, "")
-}
-func (this *Event_Subtype) GoString() string {
-	if this == nil {
-		return "nil"
-	}
-	s := make([]string, 0, 5)
-	s = append(s, "&events.Event_Subtype{")
+	s = append(s, "&events.Subtype{")
 	if this.State != nil {
-		s = append(s, "State: "+valueToGoStringEvents(this.State, "events.issue312.TaskState")+",\n")
+		s = append(s, "State: "+valueToGoStringEvents(this.State, "issue312.TaskState")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -182,22 +116,13 @@
 	pv := reflect.Indirect(rv).Interface()
 	return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
 }
-func NewPopulatedEvent(r randyEvents, easy bool) *Event {
-	this := &Event{}
+func NewPopulatedSubtype(r randyEvents, easy bool) *Subtype {
+	this := &Subtype{}
 	if r.Intn(10) != 0 {
-		this.Subtype = NewPopulatedEvent_Subtype(r, easy)
+		v1 := issue312.TaskState([]int32{6, 0, 1}[r.Intn(3)])
+		this.State = &v1
 	}
 	if !easy && r.Intn(10) != 0 {
-		this.XXX_unrecognized = randUnrecognizedEvents(r, 3)
-	}
-	return this
-}
-
-func NewPopulatedEvent_Subtype(r randyEvents, easy bool) *Event_Subtype {
-	this := &Event_Subtype{}
-	v1 := issue312.TaskState([]int32{6, 0, 1}[r.Intn(3)])
-	this.State = &v1
-	if !easy && r.Intn(10) != 0 {
 		this.XXX_unrecognized = randUnrecognizedEvents(r, 5)
 	}
 	return this
@@ -279,18 +204,16 @@
 func init() { proto.RegisterFile("events.proto", fileDescriptorEvents) }
 
 var fileDescriptorEvents = []byte{
-	// 195 bytes of a gzipped FileDescriptorProto
+	// 162 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x2d, 0x4b, 0xcd,
 	0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcf, 0x2c, 0x2e, 0x2e, 0x4d, 0x35,
 	0x36, 0x34, 0xd2, 0x83, 0x08, 0x4b, 0x99, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7,
 	0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xd5, 0x25, 0x95, 0xa6, 0xe9, 0x97, 0xa4, 0x16,
 	0x97, 0xe8, 0xc3, 0x94, 0xc3, 0x19, 0x10, 0x73, 0xa4, 0x74, 0x71, 0x6a, 0x03, 0xf1, 0xc0, 0x1c,
-	0x30, 0x0b, 0xa2, 0x5c, 0xa9, 0x9c, 0x8b, 0xd5, 0x15, 0x64, 0x9f, 0x90, 0x05, 0x17, 0x7b, 0x71,
-	0x69, 0x52, 0x49, 0x65, 0x41, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x9c, 0x1e, 0x9a,
-	0x8b, 0xf4, 0xc0, 0x0a, 0xf5, 0x82, 0x21, 0xaa, 0x82, 0x60, 0xca, 0xa5, 0x4c, 0xb8, 0xd8, 0xa1,
-	0x62, 0x42, 0x9a, 0x5c, 0xac, 0xc5, 0x25, 0x89, 0x25, 0xa9, 0x12, 0x2c, 0x0a, 0x4c, 0x1a, 0x7c,
-	0x46, 0xc2, 0x08, 0x23, 0x42, 0x12, 0x8b, 0xb3, 0x83, 0x41, 0x52, 0x41, 0x10, 0x15, 0x4e, 0x12,
-	0x1f, 0x1e, 0xca, 0x31, 0xfe, 0x78, 0x28, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x8e, 0x47, 0x72,
-	0x8c, 0x51, 0x6c, 0x10, 0x6b, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0x76, 0x73, 0x22, 0x20, 0x18,
-	0x01, 0x00, 0x00,
+	0x30, 0x0b, 0xa2, 0x5c, 0xc9, 0x84, 0x8b, 0x3d, 0xb8, 0x34, 0xa9, 0xa4, 0xb2, 0x20, 0x55, 0x48,
+	0x93, 0x8b, 0xb5, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0x82, 0x45, 0x81, 0x51, 0x83, 0xcf, 0x48, 0x58,
+	0x0f, 0x6e, 0x72, 0x48, 0x62, 0x71, 0x76, 0x30, 0x48, 0x2a, 0x08, 0xa2, 0xc2, 0x49, 0xe2, 0xc3,
+	0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x57, 0x3c, 0x92, 0x63, 0xdc, 0xf1, 0x48, 0x8e, 0x31,
+	0x8a, 0x0d, 0xe2, 0x6a, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x76, 0xdc, 0x82, 0xd5, 0x00,
+	0x00, 0x00,
 }
diff --git a/test/issue312/events/events.proto b/test/issue312/events/events.proto
index edcb93e..23bd129 100644
--- a/test/issue312/events/events.proto
+++ b/test/issue312/events/events.proto
@@ -11,10 +11,7 @@
 option (gogoproto.equal_all) = true;
 option (gogoproto.testgen_all) = true;
 
-
-message Event {
-  message Subtype {
-    required TaskState state = 4;
-  }
-  optional Subtype subtype = 2;
+message Subtype {
+  optional issue312.TaskState state = 4;
 }
+
diff --git a/test/issue312/events/eventspb_test.go b/test/issue312/events/eventspb_test.go
index c76971c..5a1cf58 100644
--- a/test/issue312/events/eventspb_test.go
+++ b/test/issue312/events/eventspb_test.go
@@ -8,7 +8,7 @@
 	events.proto
 
 It has these top-level messages:
-	Event
+	Subtype
 */
 package events
 
@@ -29,15 +29,15 @@
 var _ = fmt.Errorf
 var _ = math.Inf
 
-func TestEventProto(t *testing.T) {
+func TestSubtypeProto(t *testing.T) {
 	seed := time.Now().UnixNano()
 	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent(popr, false)
+	p := NewPopulatedSubtype(popr, false)
 	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
 	if err != nil {
 		t.Fatalf("seed = %d, err = %v", seed, err)
 	}
-	msg := &Event{}
+	msg := &Subtype{}
 	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
 		t.Fatalf("seed = %d, err = %v", seed, err)
 	}
@@ -60,47 +60,16 @@
 	}
 }
 
-func TestEvent_SubtypeProto(t *testing.T) {
+func TestSubtypeJSON(t *testing.T) {
 	seed := time.Now().UnixNano()
 	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent_Subtype(popr, false)
-	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
-	if err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	msg := &Event_Subtype{}
-	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	littlefuzz := make([]byte, len(dAtA))
-	copy(littlefuzz, dAtA)
-	for i := range dAtA {
-		dAtA[i] = byte(popr.Intn(256))
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
-	}
-	if len(littlefuzz) > 0 {
-		fuzzamount := 100
-		for i := 0; i < fuzzamount; i++ {
-			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
-			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
-		}
-		// shouldn't panic
-		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
-	}
-}
-
-func TestEventJSON(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent(popr, true)
+	p := NewPopulatedSubtype(popr, true)
 	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
 	jsondata, err := marshaler.MarshalToString(p)
 	if err != nil {
 		t.Fatalf("seed = %d, err = %v", seed, err)
 	}
-	msg := &Event{}
+	msg := &Subtype{}
 	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
 	if err != nil {
 		t.Fatalf("seed = %d, err = %v", seed, err)
@@ -109,30 +78,12 @@
 		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
 	}
 }
-func TestEvent_SubtypeJSON(t *testing.T) {
+func TestSubtypeProtoText(t *testing.T) {
 	seed := time.Now().UnixNano()
 	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent_Subtype(popr, true)
-	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
-	jsondata, err := marshaler.MarshalToString(p)
-	if err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	msg := &Event_Subtype{}
-	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
-	if err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
-	}
-}
-func TestEventProtoText(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent(popr, true)
+	p := NewPopulatedSubtype(popr, true)
 	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
-	msg := &Event{}
+	msg := &Subtype{}
 	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
 		t.Fatalf("seed = %d, err = %v", seed, err)
 	}
@@ -141,12 +92,12 @@
 	}
 }
 
-func TestEventProtoCompactText(t *testing.T) {
+func TestSubtypeProtoCompactText(t *testing.T) {
 	seed := time.Now().UnixNano()
 	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent(popr, true)
+	p := NewPopulatedSubtype(popr, true)
 	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
-	msg := &Event{}
+	msg := &Subtype{}
 	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
 		t.Fatalf("seed = %d, err = %v", seed, err)
 	}
@@ -155,50 +106,9 @@
 	}
 }
 
-func TestEvent_SubtypeProtoText(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent_Subtype(popr, true)
-	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
-	msg := &Event_Subtype{}
-	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
-	}
-}
-
-func TestEvent_SubtypeProtoCompactText(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedEvent_Subtype(popr, true)
-	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
-	msg := &Event_Subtype{}
-	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
-	}
-}
-
-func TestEventGoString(t *testing.T) {
+func TestSubtypeGoString(t *testing.T) {
 	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
-	p := NewPopulatedEvent(popr, false)
-	s1 := p.GoString()
-	s2 := fmt.Sprintf("%#v", p)
-	if s1 != s2 {
-		t.Fatalf("GoString want %v got %v", s1, s2)
-	}
-	_, err := go_parser.ParseExpr(s1)
-	if err != nil {
-		panic(err)
-	}
-}
-func TestEvent_SubtypeGoString(t *testing.T) {
-	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
-	p := NewPopulatedEvent_Subtype(popr, false)
+	p := NewPopulatedSubtype(popr, false)
 	s1 := p.GoString()
 	s2 := fmt.Sprintf("%#v", p)
 	if s1 != s2 {
diff --git a/test/issue312/issue312.pb.go b/test/issue312/issue312.pb.go
index 9c11030..56a3c51 100644
--- a/test/issue312/issue312.pb.go
+++ b/test/issue312/issue312.pb.go
@@ -8,7 +8,6 @@
 	issue312.proto
 
 It has these top-level messages:
-	TaskInfo
 */
 package issue312
 
@@ -17,11 +16,6 @@
 import math "math"
 import _ "github.com/gogo/protobuf/gogoproto"
 
-import bytes "bytes"
-
-import strings "strings"
-import reflect "reflect"
-
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
 var _ = fmt.Errorf
@@ -70,186 +64,22 @@
 }
 func (TaskState) EnumDescriptor() ([]byte, []int) { return fileDescriptorIssue312, []int{0} }
 
-type TaskInfo struct {
-	State            *TaskState `protobuf:"varint,10,req,name=state,enum=issue312.TaskState" json:"state,omitempty"`
-	XXX_unrecognized []byte     `json:"-"`
-}
-
-func (m *TaskInfo) Reset()                    { *m = TaskInfo{} }
-func (m *TaskInfo) String() string            { return proto.CompactTextString(m) }
-func (*TaskInfo) ProtoMessage()               {}
-func (*TaskInfo) Descriptor() ([]byte, []int) { return fileDescriptorIssue312, []int{0} }
-
-func (m *TaskInfo) GetState() TaskState {
-	if m != nil && m.State != nil {
-		return *m.State
-	}
-	return TaskState_TASK_STAGING
-}
-
 func init() {
-	proto.RegisterType((*TaskInfo)(nil), "issue312.TaskInfo")
 	proto.RegisterEnum("issue312.TaskState", TaskState_name, TaskState_value)
 }
-func (this *TaskInfo) Equal(that interface{}) bool {
-	if that == nil {
-		if this == nil {
-			return true
-		}
-		return false
-	}
-
-	that1, ok := that.(*TaskInfo)
-	if !ok {
-		that2, ok := that.(TaskInfo)
-		if ok {
-			that1 = &that2
-		} else {
-			return false
-		}
-	}
-	if that1 == nil {
-		if this == nil {
-			return true
-		}
-		return false
-	} else if this == nil {
-		return false
-	}
-	if this.State != nil && that1.State != nil {
-		if *this.State != *that1.State {
-			return false
-		}
-	} else if this.State != nil {
-		return false
-	} else if that1.State != nil {
-		return false
-	}
-	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
-		return false
-	}
-	return true
-}
-func (this *TaskInfo) GoString() string {
-	if this == nil {
-		return "nil"
-	}
-	s := make([]string, 0, 5)
-	s = append(s, "&issue312.TaskInfo{")
-	if this.State != nil {
-		s = append(s, "State: "+valueToGoStringIssue312(this.State, "issue312.TaskState")+",\n")
-	}
-	if this.XXX_unrecognized != nil {
-		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
-	}
-	s = append(s, "}")
-	return strings.Join(s, "")
-}
-func valueToGoStringIssue312(v interface{}, typ string) string {
-	rv := reflect.ValueOf(v)
-	if rv.IsNil() {
-		return "nil"
-	}
-	pv := reflect.Indirect(rv).Interface()
-	return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
-}
-func NewPopulatedTaskInfo(r randyIssue312, easy bool) *TaskInfo {
-	this := &TaskInfo{}
-	v1 := TaskState([]int32{6, 0, 1}[r.Intn(3)])
-	this.State = &v1
-	if !easy && r.Intn(10) != 0 {
-		this.XXX_unrecognized = randUnrecognizedIssue312(r, 11)
-	}
-	return this
-}
-
-type randyIssue312 interface {
-	Float32() float32
-	Float64() float64
-	Int63() int64
-	Int31() int32
-	Uint32() uint32
-	Intn(n int) int
-}
-
-func randUTF8RuneIssue312(r randyIssue312) rune {
-	ru := r.Intn(62)
-	if ru < 10 {
-		return rune(ru + 48)
-	} else if ru < 36 {
-		return rune(ru + 55)
-	}
-	return rune(ru + 61)
-}
-func randStringIssue312(r randyIssue312) string {
-	v2 := r.Intn(100)
-	tmps := make([]rune, v2)
-	for i := 0; i < v2; i++ {
-		tmps[i] = randUTF8RuneIssue312(r)
-	}
-	return string(tmps)
-}
-func randUnrecognizedIssue312(r randyIssue312, maxFieldNumber int) (dAtA []byte) {
-	l := r.Intn(5)
-	for i := 0; i < l; i++ {
-		wire := r.Intn(4)
-		if wire == 3 {
-			wire = 5
-		}
-		fieldNumber := maxFieldNumber + r.Intn(100)
-		dAtA = randFieldIssue312(dAtA, r, fieldNumber, wire)
-	}
-	return dAtA
-}
-func randFieldIssue312(dAtA []byte, r randyIssue312, fieldNumber int, wire int) []byte {
-	key := uint32(fieldNumber)<<3 | uint32(wire)
-	switch wire {
-	case 0:
-		dAtA = encodeVarintPopulateIssue312(dAtA, uint64(key))
-		v3 := r.Int63()
-		if r.Intn(2) == 0 {
-			v3 *= -1
-		}
-		dAtA = encodeVarintPopulateIssue312(dAtA, uint64(v3))
-	case 1:
-		dAtA = encodeVarintPopulateIssue312(dAtA, uint64(key))
-		dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
-	case 2:
-		dAtA = encodeVarintPopulateIssue312(dAtA, uint64(key))
-		ll := r.Intn(100)
-		dAtA = encodeVarintPopulateIssue312(dAtA, uint64(ll))
-		for j := 0; j < ll; j++ {
-			dAtA = append(dAtA, byte(r.Intn(256)))
-		}
-	default:
-		dAtA = encodeVarintPopulateIssue312(dAtA, uint64(key))
-		dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
-	}
-	return dAtA
-}
-func encodeVarintPopulateIssue312(dAtA []byte, v uint64) []byte {
-	for v >= 1<<7 {
-		dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
-		v >>= 7
-	}
-	dAtA = append(dAtA, uint8(v))
-	return dAtA
-}
 
 func init() { proto.RegisterFile("issue312.proto", fileDescriptorIssue312) }
 
 var fileDescriptorIssue312 = []byte{
-	// 180 bytes of a gzipped FileDescriptorProto
+	// 147 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x2c, 0x2e, 0x2e,
 	0x4d, 0x35, 0x36, 0x34, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x74,
 	0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5,
-	0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x54, 0x32, 0xe5, 0xe2,
-	0x08, 0x49, 0x2c, 0xce, 0xf6, 0xcc, 0x4b, 0xcb, 0x17, 0xd2, 0xe4, 0x62, 0x2d, 0x2e, 0x49, 0x2c,
-	0x49, 0x95, 0xe0, 0x52, 0x60, 0xd2, 0xe0, 0x33, 0x12, 0xd6, 0x83, 0x5b, 0x02, 0x52, 0x12, 0x0c,
-	0x92, 0x0a, 0x82, 0xa8, 0xd0, 0x72, 0xe2, 0xe2, 0x84, 0x8b, 0x09, 0x09, 0x70, 0xf1, 0x84, 0x38,
-	0x06, 0x7b, 0xc7, 0x07, 0x87, 0x38, 0xba, 0x7b, 0xfa, 0xb9, 0x0b, 0xb0, 0x09, 0x09, 0x72, 0xf1,
-	0xc2, 0x44, 0x82, 0x42, 0x40, 0x42, 0x0c, 0x70, 0x45, 0x41, 0xa1, 0x7e, 0x7e, 0x20, 0x11, 0x46,
-	0x27, 0xa9, 0x0f, 0x0f, 0xe5, 0x18, 0x7f, 0x3c, 0x94, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0x71, 0xc7,
-	0x23, 0x39, 0xc6, 0x28, 0xb8, 0x2f, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x98, 0xd7, 0xc7,
-	0xe0, 0x00, 0x00, 0x00,
+	0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0xd4, 0x72, 0xe2, 0xe2,
+	0x0c, 0x49, 0x2c, 0xce, 0x0e, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0x12, 0xe0, 0xe2, 0x09, 0x71, 0x0c,
+	0xf6, 0x8e, 0x0f, 0x0e, 0x71, 0x74, 0xf7, 0xf4, 0x73, 0x17, 0x60, 0x13, 0x12, 0xe4, 0xe2, 0x85,
+	0x89, 0x04, 0x85, 0x80, 0x84, 0x18, 0xe0, 0x8a, 0x82, 0x42, 0xfd, 0xfc, 0x40, 0x22, 0x8c, 0x4e,
+	0x52, 0x1f, 0x1e, 0xca, 0x31, 0xfe, 0x78, 0x28, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x8e, 0x47,
+	0x72, 0x8c, 0x51, 0x70, 0xe7, 0x00, 0x02, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xdd, 0xde, 0x2a, 0xa9,
+	0x00, 0x00, 0x00,
 }
diff --git a/test/issue312/issue312.proto b/test/issue312/issue312.proto
index bcff737..d409d7d 100644
--- a/test/issue312/issue312.proto
+++ b/test/issue312/issue312.proto
@@ -10,10 +10,6 @@
 option (gogoproto.equal_all) = true;
 option (gogoproto.testgen_all) = true;
 
-message TaskInfo {
-  required TaskState state = 10;
-}
-
 enum TaskState {
   TASK_STAGING = 6;
   TASK_STARTING = 0;
diff --git a/test/issue312/issue312pb_test.go b/test/issue312/issue312pb_test.go
deleted file mode 100644
index 79b2885..0000000
--- a/test/issue312/issue312pb_test.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: issue312.proto
-
-/*
-Package issue312 is a generated protocol buffer package.
-
-It is generated from these files:
-	issue312.proto
-
-It has these top-level messages:
-	TaskInfo
-*/
-package issue312
-
-import testing "testing"
-import math_rand "math/rand"
-import time "time"
-import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
-import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
-import fmt "fmt"
-import go_parser "go/parser"
-import proto "github.com/gogo/protobuf/proto"
-import math "math"
-import _ "github.com/gogo/protobuf/gogoproto"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-func TestTaskInfoProto(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedTaskInfo(popr, false)
-	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
-	if err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	msg := &TaskInfo{}
-	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	littlefuzz := make([]byte, len(dAtA))
-	copy(littlefuzz, dAtA)
-	for i := range dAtA {
-		dAtA[i] = byte(popr.Intn(256))
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
-	}
-	if len(littlefuzz) > 0 {
-		fuzzamount := 100
-		for i := 0; i < fuzzamount; i++ {
-			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
-			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
-		}
-		// shouldn't panic
-		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
-	}
-}
-
-func TestTaskInfoJSON(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedTaskInfo(popr, true)
-	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
-	jsondata, err := marshaler.MarshalToString(p)
-	if err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	msg := &TaskInfo{}
-	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
-	if err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
-	}
-}
-func TestTaskInfoProtoText(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedTaskInfo(popr, true)
-	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
-	msg := &TaskInfo{}
-	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
-	}
-}
-
-func TestTaskInfoProtoCompactText(t *testing.T) {
-	seed := time.Now().UnixNano()
-	popr := math_rand.New(math_rand.NewSource(seed))
-	p := NewPopulatedTaskInfo(popr, true)
-	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
-	msg := &TaskInfo{}
-	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
-		t.Fatalf("seed = %d, err = %v", seed, err)
-	}
-	if !p.Equal(msg) {
-		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
-	}
-}
-
-func TestTaskInfoGoString(t *testing.T) {
-	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
-	p := NewPopulatedTaskInfo(popr, false)
-	s1 := p.GoString()
-	s2 := fmt.Sprintf("%#v", p)
-	if s1 != s2 {
-		t.Fatalf("GoString want %v got %v", s1, s2)
-	}
-	_, err := go_parser.ParseExpr(s1)
-	if err != nil {
-		panic(err)
-	}
-}
-
-//These tests are generated by github.com/gogo/protobuf/plugin/testgen
diff --git a/test/thetest.pb.go b/test/thetest.pb.go
index d96e6ac..7e40da6 100644
--- a/test/thetest.pb.go
+++ b/test/thetest.pb.go
@@ -19505,13 +19505,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19568,13 +19568,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.NinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.TheTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "TheTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19589,13 +19589,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnum{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19610,13 +19610,13 @@
 	s := make([]string, 0, 7)
 	s = append(s, "&test.AnotherNinOptEnumDefault{")
 	if this.Field1 != nil {
-		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "test.AnotherTestEnum")+",\n")
+		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "AnotherTestEnum")+",\n")
 	}
 	if this.Field2 != nil {
-		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "test.YetAnotherTestEnum")+",\n")
+		s = append(s, "Field2: "+valueToGoStringThetest(this.Field2, "YetAnotherTestEnum")+",\n")
 	}
 	if this.Field3 != nil {
-		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "test.YetYetAnotherTestEnum")+",\n")
+		s = append(s, "Field3: "+valueToGoStringThetest(this.Field3, "YetYetAnotherTestEnum")+",\n")
 	}
 	if this.XXX_unrecognized != nil {
 		s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
@@ -19687,7 +19687,7 @@
 		s = append(s, "Field1: "+valueToGoStringThetest(this.Field1, "int64")+",\n")
 	}
 	if this.EnumField != nil {
-		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "EnumField: "+valueToGoStringThetest(this.EnumField, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.NNM != nil {
 		s = append(s, "NNM: "+fmt.Sprintf("%#v", this.NNM)+",\n")
@@ -19744,7 +19744,7 @@
 		s = append(s, "A: "+fmt.Sprintf("%#v", this.A)+",\n")
 	}
 	if this.B != nil {
-		s = append(s, "B: "+valueToGoStringThetest(this.B, "test.NestedDefinition_NestedEnum")+",\n")
+		s = append(s, "B: "+valueToGoStringThetest(this.B, "NestedDefinition_NestedEnum")+",\n")
 	}
 	if this.C != nil {
 		s = append(s, "C: "+fmt.Sprintf("%#v", this.C)+",\n")
@@ -20060,7 +20060,7 @@
 	s := make([]string, 0, 6)
 	s = append(s, "&test.CustomNameEnum{")
 	if this.FieldA != nil {
-		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "test.TheTestEnum")+",\n")
+		s = append(s, "FieldA: "+valueToGoStringThetest(this.FieldA, "TheTestEnum")+",\n")
 	}
 	if this.FieldB != nil {
 		s = append(s, "FieldB: "+fmt.Sprintf("%#v", this.FieldB)+",\n")