瀏覽代碼

protoc-gen-go: don't depend on input file ordering (#542)

Remove generate code dependencies on the order in which source files were
provided to the compiler. In other words, "protoc a.proto b.proto" produces
the same output as "protoc b.proto a.proto".

- Include the proto package version assertion in all files.

- Use the source file name and contents to generate unique var names for
  file descriptors, rather than the file index. In other words,
  "fileDescriptor_imp_81275c260ac30f8b" rather than "fileDescriptor0".

Makes the generated code more stable in the face of unrelated changes
(i.e., adding a new file to a package won't cause generated code for
other files in irrelevant ways), as well as trivial changes in the
protoc command line.

Removes the requirement that all files in a package be compiled at
the same time. Compiling each file individually will produce the same
results as compiling all at once.
Damien Neil 8 年之前
父節點
當前提交
f4733c73b3
共有 29 個文件被更改,包括 915 次插入540 次删除
  1. 41 25
      _conformance/conformance.pb.go
  2. 37 23
      jsonpb/jsonpb_test_proto/more_test_objects.pb.go
  3. 89 55
      jsonpb/jsonpb_test_proto/test_objects.pb.go
  4. 271 177
      proto/test_proto/test.pb.go
  5. 41 14
      protoc-gen-go/generator/generator.go
  6. 19 11
      protoc-gen-go/testdata/deprecated/deprecated.pb.go
  7. 16 10
      protoc-gen-go/testdata/extension_base/extension_base.pb.go
  8. 10 6
      protoc-gen-go/testdata/extension_extra/extension_extra.pb.go
  9. 40 26
      protoc-gen-go/testdata/extension_user/extension_user.pb.go
  10. 26 18
      protoc-gen-go/testdata/grpc/grpc.pb.go
  11. 23 15
      protoc-gen-go/testdata/imp/imp.pb.go
  12. 17 7
      protoc-gen-go/testdata/imp/imp2.pb.go
  13. 14 6
      protoc-gen-go/testdata/imp/imp3.pb.go
  14. 8 6
      protoc-gen-go/testdata/imports/fmt/m.pb.go
  15. 8 6
      protoc-gen-go/testdata/imports/test_a_1/m1.pb.go
  16. 14 6
      protoc-gen-go/testdata/imports/test_a_1/m2.pb.go
  17. 8 6
      protoc-gen-go/testdata/imports/test_a_2/m3.pb.go
  18. 14 6
      protoc-gen-go/testdata/imports/test_a_2/m4.pb.go
  19. 8 6
      protoc-gen-go/testdata/imports/test_b_1/m1.pb.go
  20. 14 6
      protoc-gen-go/testdata/imports/test_b_1/m2.pb.go
  21. 10 6
      protoc-gen-go/testdata/imports/test_import_a1m1.pb.go
  22. 16 6
      protoc-gen-go/testdata/imports/test_import_a1m2.pb.go
  23. 16 6
      protoc-gen-go/testdata/imports/test_import_all.pb.go
  24. 16 6
      protoc-gen-go/testdata/imports/test_import_public.pb.go
  25. 8 6
      protoc-gen-go/testdata/multi/multi1.pb.go
  26. 17 7
      protoc-gen-go/testdata/multi/multi2.pb.go
  27. 17 7
      protoc-gen-go/testdata/multi/multi3.pb.go
  28. 80 50
      protoc-gen-go/testdata/my_test/test.pb.go
  29. 17 11
      protoc-gen-go/testdata/proto3/proto3.pb.go

+ 41 - 25
_conformance/conformance.pb.go

@@ -46,7 +46,9 @@ var WireFormat_value = map[string]int32{
 func (x WireFormat) String() string {
 	return proto.EnumName(WireFormat_name, int32(x))
 }
-func (WireFormat) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (WireFormat) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{0}
+}
 
 type ForeignEnum int32
 
@@ -70,7 +72,9 @@ var ForeignEnum_value = map[string]int32{
 func (x ForeignEnum) String() string {
 	return proto.EnumName(ForeignEnum_name, int32(x))
 }
-func (ForeignEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (ForeignEnum) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{1}
+}
 
 type TestAllTypes_NestedEnum int32
 
@@ -97,7 +101,9 @@ var TestAllTypes_NestedEnum_value = map[string]int32{
 func (x TestAllTypes_NestedEnum) String() string {
 	return proto.EnumName(TestAllTypes_NestedEnum_name, int32(x))
 }
-func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
+func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{2, 0}
+}
 
 // Represents a single test case's input.  The testee should:
 //
@@ -119,10 +125,12 @@ type ConformanceRequest struct {
 	XXX_sizecache         int32      `json:"-"`
 }
 
-func (m *ConformanceRequest) Reset()                    { *m = ConformanceRequest{} }
-func (m *ConformanceRequest) String() string            { return proto.CompactTextString(m) }
-func (*ConformanceRequest) ProtoMessage()               {}
-func (*ConformanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *ConformanceRequest) Reset()         { *m = ConformanceRequest{} }
+func (m *ConformanceRequest) String() string { return proto.CompactTextString(m) }
+func (*ConformanceRequest) ProtoMessage()    {}
+func (*ConformanceRequest) Descriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{0}
+}
 func (m *ConformanceRequest) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ConformanceRequest.Unmarshal(m, b)
 }
@@ -264,10 +272,12 @@ type ConformanceResponse struct {
 	XXX_sizecache        int32                        `json:"-"`
 }
 
-func (m *ConformanceResponse) Reset()                    { *m = ConformanceResponse{} }
-func (m *ConformanceResponse) String() string            { return proto.CompactTextString(m) }
-func (*ConformanceResponse) ProtoMessage()               {}
-func (*ConformanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *ConformanceResponse) Reset()         { *m = ConformanceResponse{} }
+func (m *ConformanceResponse) String() string { return proto.CompactTextString(m) }
+func (*ConformanceResponse) ProtoMessage()    {}
+func (*ConformanceResponse) Descriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{1}
+}
 func (m *ConformanceResponse) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ConformanceResponse.Unmarshal(m, b)
 }
@@ -626,10 +636,12 @@ type TestAllTypes struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *TestAllTypes) Reset()                    { *m = TestAllTypes{} }
-func (m *TestAllTypes) String() string            { return proto.CompactTextString(m) }
-func (*TestAllTypes) ProtoMessage()               {}
-func (*TestAllTypes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *TestAllTypes) Reset()         { *m = TestAllTypes{} }
+func (m *TestAllTypes) String() string { return proto.CompactTextString(m) }
+func (*TestAllTypes) ProtoMessage()    {}
+func (*TestAllTypes) Descriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{2}
+}
 func (m *TestAllTypes) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_TestAllTypes.Unmarshal(m, b)
 }
@@ -1711,10 +1723,12 @@ type TestAllTypes_NestedMessage struct {
 	XXX_sizecache        int32         `json:"-"`
 }
 
-func (m *TestAllTypes_NestedMessage) Reset()                    { *m = TestAllTypes_NestedMessage{} }
-func (m *TestAllTypes_NestedMessage) String() string            { return proto.CompactTextString(m) }
-func (*TestAllTypes_NestedMessage) ProtoMessage()               {}
-func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
+func (m *TestAllTypes_NestedMessage) Reset()         { *m = TestAllTypes_NestedMessage{} }
+func (m *TestAllTypes_NestedMessage) String() string { return proto.CompactTextString(m) }
+func (*TestAllTypes_NestedMessage) ProtoMessage()    {}
+func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{2, 0}
+}
 func (m *TestAllTypes_NestedMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_TestAllTypes_NestedMessage.Unmarshal(m, b)
 }
@@ -1754,10 +1768,12 @@ type ForeignMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *ForeignMessage) Reset()                    { *m = ForeignMessage{} }
-func (m *ForeignMessage) String() string            { return proto.CompactTextString(m) }
-func (*ForeignMessage) ProtoMessage()               {}
-func (*ForeignMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *ForeignMessage) Reset()         { *m = ForeignMessage{} }
+func (m *ForeignMessage) String() string { return proto.CompactTextString(m) }
+func (*ForeignMessage) ProtoMessage()    {}
+func (*ForeignMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_conformance_3cdb5b28737909f3, []int{3}
+}
 func (m *ForeignMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ForeignMessage.Unmarshal(m, b)
 }
@@ -1813,9 +1829,9 @@ func init() {
 	proto.RegisterEnum("conformance.TestAllTypes_NestedEnum", TestAllTypes_NestedEnum_name, TestAllTypes_NestedEnum_value)
 }
 
-func init() { proto.RegisterFile("conformance.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("conformance.proto", fileDescriptor_conformance_3cdb5b28737909f3) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_conformance_3cdb5b28737909f3 = []byte{
 	// 2731 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0x59, 0x73, 0xdb, 0xc8,
 	0x11, 0x16, 0x08, 0x59, 0xc7, 0x90, 0x92, 0xa8, 0xd1, 0x35, 0x96, 0x5d, 0x6b, 0x58, 0xb6, 0x63,

+ 37 - 23
jsonpb/jsonpb_test_proto/more_test_objects.pb.go

@@ -40,7 +40,9 @@ var Numeral_value = map[string]int32{
 func (x Numeral) String() string {
 	return proto.EnumName(Numeral_name, int32(x))
 }
-func (Numeral) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (Numeral) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{0}
+}
 
 type Simple3 struct {
 	Dub                  float64  `protobuf:"fixed64,1,opt,name=dub" json:"dub,omitempty"`
@@ -49,10 +51,12 @@ type Simple3 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Simple3) Reset()                    { *m = Simple3{} }
-func (m *Simple3) String() string            { return proto.CompactTextString(m) }
-func (*Simple3) ProtoMessage()               {}
-func (*Simple3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *Simple3) Reset()         { *m = Simple3{} }
+func (m *Simple3) String() string { return proto.CompactTextString(m) }
+func (*Simple3) ProtoMessage()    {}
+func (*Simple3) Descriptor() ([]byte, []int) {
+	return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{0}
+}
 func (m *Simple3) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Simple3.Unmarshal(m, b)
 }
@@ -85,10 +89,12 @@ type SimpleSlice3 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *SimpleSlice3) Reset()                    { *m = SimpleSlice3{} }
-func (m *SimpleSlice3) String() string            { return proto.CompactTextString(m) }
-func (*SimpleSlice3) ProtoMessage()               {}
-func (*SimpleSlice3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *SimpleSlice3) Reset()         { *m = SimpleSlice3{} }
+func (m *SimpleSlice3) String() string { return proto.CompactTextString(m) }
+func (*SimpleSlice3) ProtoMessage()    {}
+func (*SimpleSlice3) Descriptor() ([]byte, []int) {
+	return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{1}
+}
 func (m *SimpleSlice3) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_SimpleSlice3.Unmarshal(m, b)
 }
@@ -121,10 +127,12 @@ type SimpleMap3 struct {
 	XXX_sizecache        int32             `json:"-"`
 }
 
-func (m *SimpleMap3) Reset()                    { *m = SimpleMap3{} }
-func (m *SimpleMap3) String() string            { return proto.CompactTextString(m) }
-func (*SimpleMap3) ProtoMessage()               {}
-func (*SimpleMap3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *SimpleMap3) Reset()         { *m = SimpleMap3{} }
+func (m *SimpleMap3) String() string { return proto.CompactTextString(m) }
+func (*SimpleMap3) ProtoMessage()    {}
+func (*SimpleMap3) Descriptor() ([]byte, []int) {
+	return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{2}
+}
 func (m *SimpleMap3) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_SimpleMap3.Unmarshal(m, b)
 }
@@ -157,10 +165,12 @@ type SimpleNull3 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *SimpleNull3) Reset()                    { *m = SimpleNull3{} }
-func (m *SimpleNull3) String() string            { return proto.CompactTextString(m) }
-func (*SimpleNull3) ProtoMessage()               {}
-func (*SimpleNull3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *SimpleNull3) Reset()         { *m = SimpleNull3{} }
+func (m *SimpleNull3) String() string { return proto.CompactTextString(m) }
+func (*SimpleNull3) ProtoMessage()    {}
+func (*SimpleNull3) Descriptor() ([]byte, []int) {
+	return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{3}
+}
 func (m *SimpleNull3) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_SimpleNull3.Unmarshal(m, b)
 }
@@ -202,10 +212,12 @@ type Mappy struct {
 	XXX_sizecache        int32              `json:"-"`
 }
 
-func (m *Mappy) Reset()                    { *m = Mappy{} }
-func (m *Mappy) String() string            { return proto.CompactTextString(m) }
-func (*Mappy) ProtoMessage()               {}
-func (*Mappy) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
+func (m *Mappy) Reset()         { *m = Mappy{} }
+func (m *Mappy) String() string { return proto.CompactTextString(m) }
+func (*Mappy) ProtoMessage()    {}
+func (*Mappy) Descriptor() ([]byte, []int) {
+	return fileDescriptor_more_test_objects_bef0d79b901f4c4a, []int{4}
+}
 func (m *Mappy) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Mappy.Unmarshal(m, b)
 }
@@ -314,9 +326,11 @@ func init() {
 	proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value)
 }
 
-func init() { proto.RegisterFile("more_test_objects.proto", fileDescriptor0) }
+func init() {
+	proto.RegisterFile("more_test_objects.proto", fileDescriptor_more_test_objects_bef0d79b901f4c4a)
+}
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_more_test_objects_bef0d79b901f4c4a = []byte{
 	// 526 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdd, 0x6b, 0xdb, 0x3c,
 	0x14, 0x87, 0x5f, 0x27, 0xf5, 0xd7, 0x49, 0xfb, 0x2e, 0x88, 0xb1, 0x99, 0xf4, 0x62, 0xc5, 0xb0,

+ 89 - 55
jsonpb/jsonpb_test_proto/test_objects.pb.go

@@ -17,6 +17,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type Widget_Color int32
 
 const (
@@ -52,7 +58,9 @@ func (x *Widget_Color) UnmarshalJSON(data []byte) error {
 	*x = Widget_Color(value)
 	return nil
 }
-func (Widget_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{3, 0} }
+func (Widget_Color) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{3, 0}
+}
 
 // Test message for holding primitive types.
 type Simple struct {
@@ -72,10 +80,12 @@ type Simple struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Simple) Reset()                    { *m = Simple{} }
-func (m *Simple) String() string            { return proto.CompactTextString(m) }
-func (*Simple) ProtoMessage()               {}
-func (*Simple) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *Simple) Reset()         { *m = Simple{} }
+func (m *Simple) String() string { return proto.CompactTextString(m) }
+func (*Simple) ProtoMessage()    {}
+func (*Simple) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{0}
+}
 func (m *Simple) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Simple.Unmarshal(m, b)
 }
@@ -184,10 +194,12 @@ type NonFinites struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *NonFinites) Reset()                    { *m = NonFinites{} }
-func (m *NonFinites) String() string            { return proto.CompactTextString(m) }
-func (*NonFinites) ProtoMessage()               {}
-func (*NonFinites) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
+func (m *NonFinites) Reset()         { *m = NonFinites{} }
+func (m *NonFinites) String() string { return proto.CompactTextString(m) }
+func (*NonFinites) ProtoMessage()    {}
+func (*NonFinites) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{1}
+}
 func (m *NonFinites) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_NonFinites.Unmarshal(m, b)
 }
@@ -266,10 +278,12 @@ type Repeats struct {
 	XXX_sizecache        int32     `json:"-"`
 }
 
-func (m *Repeats) Reset()                    { *m = Repeats{} }
-func (m *Repeats) String() string            { return proto.CompactTextString(m) }
-func (*Repeats) ProtoMessage()               {}
-func (*Repeats) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
+func (m *Repeats) Reset()         { *m = Repeats{} }
+func (m *Repeats) String() string { return proto.CompactTextString(m) }
+func (*Repeats) ProtoMessage()    {}
+func (*Repeats) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{2}
+}
 func (m *Repeats) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Repeats.Unmarshal(m, b)
 }
@@ -378,10 +392,12 @@ type Widget struct {
 	XXX_sizecache        int32          `json:"-"`
 }
 
-func (m *Widget) Reset()                    { *m = Widget{} }
-func (m *Widget) String() string            { return proto.CompactTextString(m) }
-func (*Widget) ProtoMessage()               {}
-func (*Widget) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }
+func (m *Widget) Reset()         { *m = Widget{} }
+func (m *Widget) String() string { return proto.CompactTextString(m) }
+func (*Widget) ProtoMessage()    {}
+func (*Widget) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{3}
+}
 func (m *Widget) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Widget.Unmarshal(m, b)
 }
@@ -450,10 +466,12 @@ type Maps struct {
 	XXX_sizecache        int32            `json:"-"`
 }
 
-func (m *Maps) Reset()                    { *m = Maps{} }
-func (m *Maps) String() string            { return proto.CompactTextString(m) }
-func (*Maps) ProtoMessage()               {}
-func (*Maps) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }
+func (m *Maps) Reset()         { *m = Maps{} }
+func (m *Maps) String() string { return proto.CompactTextString(m) }
+func (*Maps) ProtoMessage()    {}
+func (*Maps) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{4}
+}
 func (m *Maps) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Maps.Unmarshal(m, b)
 }
@@ -499,10 +517,12 @@ type MsgWithOneof struct {
 	XXX_sizecache        int32                `json:"-"`
 }
 
-func (m *MsgWithOneof) Reset()                    { *m = MsgWithOneof{} }
-func (m *MsgWithOneof) String() string            { return proto.CompactTextString(m) }
-func (*MsgWithOneof) ProtoMessage()               {}
-func (*MsgWithOneof) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} }
+func (m *MsgWithOneof) Reset()         { *m = MsgWithOneof{} }
+func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) }
+func (*MsgWithOneof) ProtoMessage()    {}
+func (*MsgWithOneof) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{5}
+}
 func (m *MsgWithOneof) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MsgWithOneof.Unmarshal(m, b)
 }
@@ -711,10 +731,12 @@ type Real struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *Real) Reset()                    { *m = Real{} }
-func (m *Real) String() string            { return proto.CompactTextString(m) }
-func (*Real) ProtoMessage()               {}
-func (*Real) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} }
+func (m *Real) Reset()         { *m = Real{} }
+func (m *Real) String() string { return proto.CompactTextString(m) }
+func (*Real) ProtoMessage()    {}
+func (*Real) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{6}
+}
 
 var extRange_Real = []proto.ExtensionRange{
 	{100, 536870911},
@@ -756,10 +778,12 @@ type Complex struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *Complex) Reset()                    { *m = Complex{} }
-func (m *Complex) String() string            { return proto.CompactTextString(m) }
-func (*Complex) ProtoMessage()               {}
-func (*Complex) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} }
+func (m *Complex) Reset()         { *m = Complex{} }
+func (m *Complex) String() string { return proto.CompactTextString(m) }
+func (*Complex) ProtoMessage()    {}
+func (*Complex) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{7}
+}
 
 var extRange_Complex = []proto.ExtensionRange{
 	{100, 536870911},
@@ -823,10 +847,12 @@ type KnownTypes struct {
 	XXX_sizecache        int32                         `json:"-"`
 }
 
-func (m *KnownTypes) Reset()                    { *m = KnownTypes{} }
-func (m *KnownTypes) String() string            { return proto.CompactTextString(m) }
-func (*KnownTypes) ProtoMessage()               {}
-func (*KnownTypes) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} }
+func (m *KnownTypes) Reset()         { *m = KnownTypes{} }
+func (m *KnownTypes) String() string { return proto.CompactTextString(m) }
+func (*KnownTypes) ProtoMessage()    {}
+func (*KnownTypes) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{8}
+}
 func (m *KnownTypes) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_KnownTypes.Unmarshal(m, b)
 }
@@ -958,10 +984,12 @@ type MsgWithRequired struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *MsgWithRequired) Reset()                    { *m = MsgWithRequired{} }
-func (m *MsgWithRequired) String() string            { return proto.CompactTextString(m) }
-func (*MsgWithRequired) ProtoMessage()               {}
-func (*MsgWithRequired) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} }
+func (m *MsgWithRequired) Reset()         { *m = MsgWithRequired{} }
+func (m *MsgWithRequired) String() string { return proto.CompactTextString(m) }
+func (*MsgWithRequired) ProtoMessage()    {}
+func (*MsgWithRequired) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{9}
+}
 func (m *MsgWithRequired) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MsgWithRequired.Unmarshal(m, b)
 }
@@ -996,10 +1024,12 @@ type MsgWithIndirectRequired struct {
 	XXX_sizecache        int32                       `json:"-"`
 }
 
-func (m *MsgWithIndirectRequired) Reset()                    { *m = MsgWithIndirectRequired{} }
-func (m *MsgWithIndirectRequired) String() string            { return proto.CompactTextString(m) }
-func (*MsgWithIndirectRequired) ProtoMessage()               {}
-func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} }
+func (m *MsgWithIndirectRequired) Reset()         { *m = MsgWithIndirectRequired{} }
+func (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) }
+func (*MsgWithIndirectRequired) ProtoMessage()    {}
+func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{10}
+}
 func (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MsgWithIndirectRequired.Unmarshal(m, b)
 }
@@ -1046,10 +1076,12 @@ type MsgWithRequiredBytes struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *MsgWithRequiredBytes) Reset()                    { *m = MsgWithRequiredBytes{} }
-func (m *MsgWithRequiredBytes) String() string            { return proto.CompactTextString(m) }
-func (*MsgWithRequiredBytes) ProtoMessage()               {}
-func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11} }
+func (m *MsgWithRequiredBytes) Reset()         { *m = MsgWithRequiredBytes{} }
+func (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) }
+func (*MsgWithRequiredBytes) ProtoMessage()    {}
+func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{11}
+}
 func (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MsgWithRequiredBytes.Unmarshal(m, b)
 }
@@ -1082,10 +1114,12 @@ type MsgWithRequiredWKT struct {
 	XXX_sizecache        int32                         `json:"-"`
 }
 
-func (m *MsgWithRequiredWKT) Reset()                    { *m = MsgWithRequiredWKT{} }
-func (m *MsgWithRequiredWKT) String() string            { return proto.CompactTextString(m) }
-func (*MsgWithRequiredWKT) ProtoMessage()               {}
-func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} }
+func (m *MsgWithRequiredWKT) Reset()         { *m = MsgWithRequiredWKT{} }
+func (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) }
+func (*MsgWithRequiredWKT) ProtoMessage()    {}
+func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_objects_c6f6c615ab823e65, []int{12}
+}
 func (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MsgWithRequiredWKT.Unmarshal(m, b)
 }
@@ -1152,9 +1186,9 @@ func init() {
 	proto.RegisterExtension(E_Extm)
 }
 
-func init() { proto.RegisterFile("test_objects.proto", fileDescriptor1) }
+func init() { proto.RegisterFile("test_objects.proto", fileDescriptor_test_objects_c6f6c615ab823e65) }
 
-var fileDescriptor1 = []byte{
+var fileDescriptor_test_objects_c6f6c615ab823e65 = []byte{
 	// 1357 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdd, 0x72, 0x13, 0xc7,
 	0x12, 0xf6, 0xee, 0x6a, 0xf5, 0xd3, 0xf2, 0x1f, 0x83, 0x81, 0xc5, 0x87, 0x73, 0x8e, 0x4a, 0x70,

+ 271 - 177
proto/test_proto/test.pb.go

@@ -47,7 +47,9 @@ func (x *FOO) UnmarshalJSON(data []byte) error {
 	*x = FOO(value)
 	return nil
 }
-func (FOO) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (FOO) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{0}
+}
 
 // An enum, for completeness.
 type GoTest_KIND int32
@@ -119,7 +121,9 @@ func (x *GoTest_KIND) UnmarshalJSON(data []byte) error {
 	*x = GoTest_KIND(value)
 	return nil
 }
-func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
+func (GoTest_KIND) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{2, 0}
+}
 
 type MyMessage_Color int32
 
@@ -156,7 +160,9 @@ func (x *MyMessage_Color) UnmarshalJSON(data []byte) error {
 	*x = MyMessage_Color(value)
 	return nil
 }
-func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} }
+func (MyMessage_Color) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{13, 0}
+}
 
 type DefaultsMessage_DefaultsEnum int32
 
@@ -194,7 +200,7 @@ func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error {
 	return nil
 }
 func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor0, []int{16, 0}
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{16, 0}
 }
 
 type Defaults_Color int32
@@ -232,7 +238,9 @@ func (x *Defaults_Color) UnmarshalJSON(data []byte) error {
 	*x = Defaults_Color(value)
 	return nil
 }
-func (Defaults_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{21, 0} }
+func (Defaults_Color) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{21, 0}
+}
 
 type RepeatedEnum_Color int32
 
@@ -263,7 +271,9 @@ func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error {
 	*x = RepeatedEnum_Color(value)
 	return nil
 }
-func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{23, 0} }
+func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{23, 0}
+}
 
 type GoEnum struct {
 	Foo                  *FOO     `protobuf:"varint,1,req,name=foo,enum=test_proto.FOO" json:"foo,omitempty"`
@@ -272,10 +282,12 @@ type GoEnum struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GoEnum) Reset()                    { *m = GoEnum{} }
-func (m *GoEnum) String() string            { return proto.CompactTextString(m) }
-func (*GoEnum) ProtoMessage()               {}
-func (*GoEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *GoEnum) Reset()         { *m = GoEnum{} }
+func (m *GoEnum) String() string { return proto.CompactTextString(m) }
+func (*GoEnum) ProtoMessage()    {}
+func (*GoEnum) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{0}
+}
 func (m *GoEnum) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoEnum.Unmarshal(m, b)
 }
@@ -309,10 +321,12 @@ type GoTestField struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GoTestField) Reset()                    { *m = GoTestField{} }
-func (m *GoTestField) String() string            { return proto.CompactTextString(m) }
-func (*GoTestField) ProtoMessage()               {}
-func (*GoTestField) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *GoTestField) Reset()         { *m = GoTestField{} }
+func (m *GoTestField) String() string { return proto.CompactTextString(m) }
+func (*GoTestField) ProtoMessage()    {}
+func (*GoTestField) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{1}
+}
 func (m *GoTestField) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoTestField.Unmarshal(m, b)
 }
@@ -440,10 +454,12 @@ type GoTest struct {
 	XXX_sizecache            int32                   `json:"-"`
 }
 
-func (m *GoTest) Reset()                    { *m = GoTest{} }
-func (m *GoTest) String() string            { return proto.CompactTextString(m) }
-func (*GoTest) ProtoMessage()               {}
-func (*GoTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *GoTest) Reset()         { *m = GoTest{} }
+func (m *GoTest) String() string { return proto.CompactTextString(m) }
+func (*GoTest) ProtoMessage()    {}
+func (*GoTest) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{2}
+}
 func (m *GoTest) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoTest.Unmarshal(m, b)
 }
@@ -1062,10 +1078,12 @@ type GoTest_RequiredGroup struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GoTest_RequiredGroup) Reset()                    { *m = GoTest_RequiredGroup{} }
-func (m *GoTest_RequiredGroup) String() string            { return proto.CompactTextString(m) }
-func (*GoTest_RequiredGroup) ProtoMessage()               {}
-func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
+func (m *GoTest_RequiredGroup) Reset()         { *m = GoTest_RequiredGroup{} }
+func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) }
+func (*GoTest_RequiredGroup) ProtoMessage()    {}
+func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{2, 0}
+}
 func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b)
 }
@@ -1098,10 +1116,12 @@ type GoTest_RepeatedGroup struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GoTest_RepeatedGroup) Reset()                    { *m = GoTest_RepeatedGroup{} }
-func (m *GoTest_RepeatedGroup) String() string            { return proto.CompactTextString(m) }
-func (*GoTest_RepeatedGroup) ProtoMessage()               {}
-func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 1} }
+func (m *GoTest_RepeatedGroup) Reset()         { *m = GoTest_RepeatedGroup{} }
+func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) }
+func (*GoTest_RepeatedGroup) ProtoMessage()    {}
+func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{2, 1}
+}
 func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b)
 }
@@ -1134,10 +1154,12 @@ type GoTest_OptionalGroup struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GoTest_OptionalGroup) Reset()                    { *m = GoTest_OptionalGroup{} }
-func (m *GoTest_OptionalGroup) String() string            { return proto.CompactTextString(m) }
-func (*GoTest_OptionalGroup) ProtoMessage()               {}
-func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 2} }
+func (m *GoTest_OptionalGroup) Reset()         { *m = GoTest_OptionalGroup{} }
+func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) }
+func (*GoTest_OptionalGroup) ProtoMessage()    {}
+func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{2, 2}
+}
 func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b)
 }
@@ -1171,10 +1193,12 @@ type GoTestRequiredGroupField struct {
 	XXX_sizecache        int32                           `json:"-"`
 }
 
-func (m *GoTestRequiredGroupField) Reset()                    { *m = GoTestRequiredGroupField{} }
-func (m *GoTestRequiredGroupField) String() string            { return proto.CompactTextString(m) }
-func (*GoTestRequiredGroupField) ProtoMessage()               {}
-func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *GoTestRequiredGroupField) Reset()         { *m = GoTestRequiredGroupField{} }
+func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) }
+func (*GoTestRequiredGroupField) ProtoMessage()    {}
+func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{3}
+}
 func (m *GoTestRequiredGroupField) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoTestRequiredGroupField.Unmarshal(m, b)
 }
@@ -1211,7 +1235,7 @@ func (m *GoTestRequiredGroupField_Group) Reset()         { *m = GoTestRequiredGr
 func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) }
 func (*GoTestRequiredGroupField_Group) ProtoMessage()    {}
 func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) {
-	return fileDescriptor0, []int{3, 0}
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{3, 0}
 }
 func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b)
@@ -1252,10 +1276,12 @@ type GoSkipTest struct {
 	XXX_sizecache        int32                 `json:"-"`
 }
 
-func (m *GoSkipTest) Reset()                    { *m = GoSkipTest{} }
-func (m *GoSkipTest) String() string            { return proto.CompactTextString(m) }
-func (*GoSkipTest) ProtoMessage()               {}
-func (*GoSkipTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
+func (m *GoSkipTest) Reset()         { *m = GoSkipTest{} }
+func (m *GoSkipTest) String() string { return proto.CompactTextString(m) }
+func (*GoSkipTest) ProtoMessage()    {}
+func (*GoSkipTest) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{4}
+}
 func (m *GoSkipTest) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoSkipTest.Unmarshal(m, b)
 }
@@ -1317,10 +1343,12 @@ type GoSkipTest_SkipGroup struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GoSkipTest_SkipGroup) Reset()                    { *m = GoSkipTest_SkipGroup{} }
-func (m *GoSkipTest_SkipGroup) String() string            { return proto.CompactTextString(m) }
-func (*GoSkipTest_SkipGroup) ProtoMessage()               {}
-func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} }
+func (m *GoSkipTest_SkipGroup) Reset()         { *m = GoSkipTest_SkipGroup{} }
+func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) }
+func (*GoSkipTest_SkipGroup) ProtoMessage()    {}
+func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{4, 0}
+}
 func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b)
 }
@@ -1362,10 +1390,12 @@ type NonPackedTest struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *NonPackedTest) Reset()                    { *m = NonPackedTest{} }
-func (m *NonPackedTest) String() string            { return proto.CompactTextString(m) }
-func (*NonPackedTest) ProtoMessage()               {}
-func (*NonPackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+func (m *NonPackedTest) Reset()         { *m = NonPackedTest{} }
+func (m *NonPackedTest) String() string { return proto.CompactTextString(m) }
+func (*NonPackedTest) ProtoMessage()    {}
+func (*NonPackedTest) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{5}
+}
 func (m *NonPackedTest) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_NonPackedTest.Unmarshal(m, b)
 }
@@ -1398,10 +1428,12 @@ type PackedTest struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *PackedTest) Reset()                    { *m = PackedTest{} }
-func (m *PackedTest) String() string            { return proto.CompactTextString(m) }
-func (*PackedTest) ProtoMessage()               {}
-func (*PackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
+func (m *PackedTest) Reset()         { *m = PackedTest{} }
+func (m *PackedTest) String() string { return proto.CompactTextString(m) }
+func (*PackedTest) ProtoMessage()    {}
+func (*PackedTest) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{6}
+}
 func (m *PackedTest) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_PackedTest.Unmarshal(m, b)
 }
@@ -1435,10 +1467,12 @@ type MaxTag struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *MaxTag) Reset()                    { *m = MaxTag{} }
-func (m *MaxTag) String() string            { return proto.CompactTextString(m) }
-func (*MaxTag) ProtoMessage()               {}
-func (*MaxTag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
+func (m *MaxTag) Reset()         { *m = MaxTag{} }
+func (m *MaxTag) String() string { return proto.CompactTextString(m) }
+func (*MaxTag) ProtoMessage()    {}
+func (*MaxTag) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{7}
+}
 func (m *MaxTag) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MaxTag.Unmarshal(m, b)
 }
@@ -1472,10 +1506,12 @@ type OldMessage struct {
 	XXX_sizecache        int32              `json:"-"`
 }
 
-func (m *OldMessage) Reset()                    { *m = OldMessage{} }
-func (m *OldMessage) String() string            { return proto.CompactTextString(m) }
-func (*OldMessage) ProtoMessage()               {}
-func (*OldMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
+func (m *OldMessage) Reset()         { *m = OldMessage{} }
+func (m *OldMessage) String() string { return proto.CompactTextString(m) }
+func (*OldMessage) ProtoMessage()    {}
+func (*OldMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{8}
+}
 func (m *OldMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_OldMessage.Unmarshal(m, b)
 }
@@ -1515,10 +1551,12 @@ type OldMessage_Nested struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *OldMessage_Nested) Reset()                    { *m = OldMessage_Nested{} }
-func (m *OldMessage_Nested) String() string            { return proto.CompactTextString(m) }
-func (*OldMessage_Nested) ProtoMessage()               {}
-func (*OldMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 0} }
+func (m *OldMessage_Nested) Reset()         { *m = OldMessage_Nested{} }
+func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) }
+func (*OldMessage_Nested) ProtoMessage()    {}
+func (*OldMessage_Nested) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{8, 0}
+}
 func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b)
 }
@@ -1555,10 +1593,12 @@ type NewMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *NewMessage) Reset()                    { *m = NewMessage{} }
-func (m *NewMessage) String() string            { return proto.CompactTextString(m) }
-func (*NewMessage) ProtoMessage()               {}
-func (*NewMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
+func (m *NewMessage) Reset()         { *m = NewMessage{} }
+func (m *NewMessage) String() string { return proto.CompactTextString(m) }
+func (*NewMessage) ProtoMessage()    {}
+func (*NewMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{9}
+}
 func (m *NewMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_NewMessage.Unmarshal(m, b)
 }
@@ -1599,10 +1639,12 @@ type NewMessage_Nested struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *NewMessage_Nested) Reset()                    { *m = NewMessage_Nested{} }
-func (m *NewMessage_Nested) String() string            { return proto.CompactTextString(m) }
-func (*NewMessage_Nested) ProtoMessage()               {}
-func (*NewMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 0} }
+func (m *NewMessage_Nested) Reset()         { *m = NewMessage_Nested{} }
+func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) }
+func (*NewMessage_Nested) ProtoMessage()    {}
+func (*NewMessage_Nested) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{9, 0}
+}
 func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b)
 }
@@ -1644,10 +1686,12 @@ type InnerMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *InnerMessage) Reset()                    { *m = InnerMessage{} }
-func (m *InnerMessage) String() string            { return proto.CompactTextString(m) }
-func (*InnerMessage) ProtoMessage()               {}
-func (*InnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
+func (m *InnerMessage) Reset()         { *m = InnerMessage{} }
+func (m *InnerMessage) String() string { return proto.CompactTextString(m) }
+func (*InnerMessage) ProtoMessage()    {}
+func (*InnerMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{10}
+}
 func (m *InnerMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_InnerMessage.Unmarshal(m, b)
 }
@@ -1700,10 +1744,12 @@ type OtherMessage struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *OtherMessage) Reset()                    { *m = OtherMessage{} }
-func (m *OtherMessage) String() string            { return proto.CompactTextString(m) }
-func (*OtherMessage) ProtoMessage()               {}
-func (*OtherMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
+func (m *OtherMessage) Reset()         { *m = OtherMessage{} }
+func (m *OtherMessage) String() string { return proto.CompactTextString(m) }
+func (*OtherMessage) ProtoMessage()    {}
+func (*OtherMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{11}
+}
 
 var extRange_OtherMessage = []proto.ExtensionRange{
 	{100, 536870911},
@@ -1765,10 +1811,12 @@ type RequiredInnerMessage struct {
 	XXX_sizecache        int32         `json:"-"`
 }
 
-func (m *RequiredInnerMessage) Reset()                    { *m = RequiredInnerMessage{} }
-func (m *RequiredInnerMessage) String() string            { return proto.CompactTextString(m) }
-func (*RequiredInnerMessage) ProtoMessage()               {}
-func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
+func (m *RequiredInnerMessage) Reset()         { *m = RequiredInnerMessage{} }
+func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) }
+func (*RequiredInnerMessage) ProtoMessage()    {}
+func (*RequiredInnerMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{12}
+}
 func (m *RequiredInnerMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_RequiredInnerMessage.Unmarshal(m, b)
 }
@@ -1814,10 +1862,12 @@ type MyMessage struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *MyMessage) Reset()                    { *m = MyMessage{} }
-func (m *MyMessage) String() string            { return proto.CompactTextString(m) }
-func (*MyMessage) ProtoMessage()               {}
-func (*MyMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
+func (m *MyMessage) Reset()         { *m = MyMessage{} }
+func (m *MyMessage) String() string { return proto.CompactTextString(m) }
+func (*MyMessage) ProtoMessage()    {}
+func (*MyMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{13}
+}
 
 var extRange_MyMessage = []proto.ExtensionRange{
 	{100, 536870911},
@@ -1935,10 +1985,12 @@ type MyMessage_SomeGroup struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *MyMessage_SomeGroup) Reset()                    { *m = MyMessage_SomeGroup{} }
-func (m *MyMessage_SomeGroup) String() string            { return proto.CompactTextString(m) }
-func (*MyMessage_SomeGroup) ProtoMessage()               {}
-func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} }
+func (m *MyMessage_SomeGroup) Reset()         { *m = MyMessage_SomeGroup{} }
+func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) }
+func (*MyMessage_SomeGroup) ProtoMessage()    {}
+func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{13, 0}
+}
 func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b)
 }
@@ -1972,10 +2024,12 @@ type Ext struct {
 	XXX_sizecache        int32           `json:"-"`
 }
 
-func (m *Ext) Reset()                    { *m = Ext{} }
-func (m *Ext) String() string            { return proto.CompactTextString(m) }
-func (*Ext) ProtoMessage()               {}
-func (*Ext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
+func (m *Ext) Reset()         { *m = Ext{} }
+func (m *Ext) String() string { return proto.CompactTextString(m) }
+func (*Ext) ProtoMessage()    {}
+func (*Ext) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{14}
+}
 func (m *Ext) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Ext.Unmarshal(m, b)
 }
@@ -2044,10 +2098,12 @@ type ComplexExtension struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *ComplexExtension) Reset()                    { *m = ComplexExtension{} }
-func (m *ComplexExtension) String() string            { return proto.CompactTextString(m) }
-func (*ComplexExtension) ProtoMessage()               {}
-func (*ComplexExtension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
+func (m *ComplexExtension) Reset()         { *m = ComplexExtension{} }
+func (m *ComplexExtension) String() string { return proto.CompactTextString(m) }
+func (*ComplexExtension) ProtoMessage()    {}
+func (*ComplexExtension) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{15}
+}
 func (m *ComplexExtension) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ComplexExtension.Unmarshal(m, b)
 }
@@ -2094,10 +2150,12 @@ type DefaultsMessage struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *DefaultsMessage) Reset()                    { *m = DefaultsMessage{} }
-func (m *DefaultsMessage) String() string            { return proto.CompactTextString(m) }
-func (*DefaultsMessage) ProtoMessage()               {}
-func (*DefaultsMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
+func (m *DefaultsMessage) Reset()         { *m = DefaultsMessage{} }
+func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) }
+func (*DefaultsMessage) ProtoMessage()    {}
+func (*DefaultsMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{16}
+}
 
 var extRange_DefaultsMessage = []proto.ExtensionRange{
 	{100, 536870911},
@@ -2131,10 +2189,12 @@ type MyMessageSet struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *MyMessageSet) Reset()                    { *m = MyMessageSet{} }
-func (m *MyMessageSet) String() string            { return proto.CompactTextString(m) }
-func (*MyMessageSet) ProtoMessage()               {}
-func (*MyMessageSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
+func (m *MyMessageSet) Reset()         { *m = MyMessageSet{} }
+func (m *MyMessageSet) String() string { return proto.CompactTextString(m) }
+func (*MyMessageSet) ProtoMessage()    {}
+func (*MyMessageSet) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{17}
+}
 
 func (m *MyMessageSet) MarshalJSON() ([]byte, error) {
 	return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
@@ -2174,10 +2234,12 @@ type Empty struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Empty) Reset()                    { *m = Empty{} }
-func (m *Empty) String() string            { return proto.CompactTextString(m) }
-func (*Empty) ProtoMessage()               {}
-func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
+func (m *Empty) Reset()         { *m = Empty{} }
+func (m *Empty) String() string { return proto.CompactTextString(m) }
+func (*Empty) ProtoMessage()    {}
+func (*Empty) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{18}
+}
 func (m *Empty) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Empty.Unmarshal(m, b)
 }
@@ -2203,10 +2265,12 @@ type MessageList struct {
 	XXX_sizecache        int32                  `json:"-"`
 }
 
-func (m *MessageList) Reset()                    { *m = MessageList{} }
-func (m *MessageList) String() string            { return proto.CompactTextString(m) }
-func (*MessageList) ProtoMessage()               {}
-func (*MessageList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
+func (m *MessageList) Reset()         { *m = MessageList{} }
+func (m *MessageList) String() string { return proto.CompactTextString(m) }
+func (*MessageList) ProtoMessage()    {}
+func (*MessageList) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{19}
+}
 func (m *MessageList) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MessageList.Unmarshal(m, b)
 }
@@ -2240,10 +2304,12 @@ type MessageList_Message struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *MessageList_Message) Reset()                    { *m = MessageList_Message{} }
-func (m *MessageList_Message) String() string            { return proto.CompactTextString(m) }
-func (*MessageList_Message) ProtoMessage()               {}
-func (*MessageList_Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19, 0} }
+func (m *MessageList_Message) Reset()         { *m = MessageList_Message{} }
+func (m *MessageList_Message) String() string { return proto.CompactTextString(m) }
+func (*MessageList_Message) ProtoMessage()    {}
+func (*MessageList_Message) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{19, 0}
+}
 func (m *MessageList_Message) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MessageList_Message.Unmarshal(m, b)
 }
@@ -2284,10 +2350,12 @@ type Strings struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Strings) Reset()                    { *m = Strings{} }
-func (m *Strings) String() string            { return proto.CompactTextString(m) }
-func (*Strings) ProtoMessage()               {}
-func (*Strings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
+func (m *Strings) Reset()         { *m = Strings{} }
+func (m *Strings) String() string { return proto.CompactTextString(m) }
+func (*Strings) ProtoMessage()    {}
+func (*Strings) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{20}
+}
 func (m *Strings) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Strings.Unmarshal(m, b)
 }
@@ -2350,10 +2418,12 @@ type Defaults struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Defaults) Reset()                    { *m = Defaults{} }
-func (m *Defaults) String() string            { return proto.CompactTextString(m) }
-func (*Defaults) ProtoMessage()               {}
-func (*Defaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
+func (m *Defaults) Reset()         { *m = Defaults{} }
+func (m *Defaults) String() string { return proto.CompactTextString(m) }
+func (*Defaults) ProtoMessage()    {}
+func (*Defaults) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{21}
+}
 func (m *Defaults) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Defaults.Unmarshal(m, b)
 }
@@ -2533,10 +2603,12 @@ type SubDefaults struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *SubDefaults) Reset()                    { *m = SubDefaults{} }
-func (m *SubDefaults) String() string            { return proto.CompactTextString(m) }
-func (*SubDefaults) ProtoMessage()               {}
-func (*SubDefaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
+func (m *SubDefaults) Reset()         { *m = SubDefaults{} }
+func (m *SubDefaults) String() string { return proto.CompactTextString(m) }
+func (*SubDefaults) ProtoMessage()    {}
+func (*SubDefaults) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{22}
+}
 func (m *SubDefaults) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_SubDefaults.Unmarshal(m, b)
 }
@@ -2571,10 +2643,12 @@ type RepeatedEnum struct {
 	XXX_sizecache        int32                `json:"-"`
 }
 
-func (m *RepeatedEnum) Reset()                    { *m = RepeatedEnum{} }
-func (m *RepeatedEnum) String() string            { return proto.CompactTextString(m) }
-func (*RepeatedEnum) ProtoMessage()               {}
-func (*RepeatedEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
+func (m *RepeatedEnum) Reset()         { *m = RepeatedEnum{} }
+func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) }
+func (*RepeatedEnum) ProtoMessage()    {}
+func (*RepeatedEnum) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{23}
+}
 func (m *RepeatedEnum) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_RepeatedEnum.Unmarshal(m, b)
 }
@@ -2613,10 +2687,12 @@ type MoreRepeated struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *MoreRepeated) Reset()                    { *m = MoreRepeated{} }
-func (m *MoreRepeated) String() string            { return proto.CompactTextString(m) }
-func (*MoreRepeated) ProtoMessage()               {}
-func (*MoreRepeated) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
+func (m *MoreRepeated) Reset()         { *m = MoreRepeated{} }
+func (m *MoreRepeated) String() string { return proto.CompactTextString(m) }
+func (*MoreRepeated) ProtoMessage()    {}
+func (*MoreRepeated) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{24}
+}
 func (m *MoreRepeated) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MoreRepeated.Unmarshal(m, b)
 }
@@ -2691,10 +2767,12 @@ type GroupOld struct {
 	XXX_sizecache        int32       `json:"-"`
 }
 
-func (m *GroupOld) Reset()                    { *m = GroupOld{} }
-func (m *GroupOld) String() string            { return proto.CompactTextString(m) }
-func (*GroupOld) ProtoMessage()               {}
-func (*GroupOld) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
+func (m *GroupOld) Reset()         { *m = GroupOld{} }
+func (m *GroupOld) String() string { return proto.CompactTextString(m) }
+func (*GroupOld) ProtoMessage()    {}
+func (*GroupOld) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{25}
+}
 func (m *GroupOld) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GroupOld.Unmarshal(m, b)
 }
@@ -2727,10 +2805,12 @@ type GroupOld_G struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GroupOld_G) Reset()                    { *m = GroupOld_G{} }
-func (m *GroupOld_G) String() string            { return proto.CompactTextString(m) }
-func (*GroupOld_G) ProtoMessage()               {}
-func (*GroupOld_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25, 0} }
+func (m *GroupOld_G) Reset()         { *m = GroupOld_G{} }
+func (m *GroupOld_G) String() string { return proto.CompactTextString(m) }
+func (*GroupOld_G) ProtoMessage()    {}
+func (*GroupOld_G) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{25, 0}
+}
 func (m *GroupOld_G) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GroupOld_G.Unmarshal(m, b)
 }
@@ -2763,10 +2843,12 @@ type GroupNew struct {
 	XXX_sizecache        int32       `json:"-"`
 }
 
-func (m *GroupNew) Reset()                    { *m = GroupNew{} }
-func (m *GroupNew) String() string            { return proto.CompactTextString(m) }
-func (*GroupNew) ProtoMessage()               {}
-func (*GroupNew) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
+func (m *GroupNew) Reset()         { *m = GroupNew{} }
+func (m *GroupNew) String() string { return proto.CompactTextString(m) }
+func (*GroupNew) ProtoMessage()    {}
+func (*GroupNew) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{26}
+}
 func (m *GroupNew) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GroupNew.Unmarshal(m, b)
 }
@@ -2800,10 +2882,12 @@ type GroupNew_G struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *GroupNew_G) Reset()                    { *m = GroupNew_G{} }
-func (m *GroupNew_G) String() string            { return proto.CompactTextString(m) }
-func (*GroupNew_G) ProtoMessage()               {}
-func (*GroupNew_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26, 0} }
+func (m *GroupNew_G) Reset()         { *m = GroupNew_G{} }
+func (m *GroupNew_G) String() string { return proto.CompactTextString(m) }
+func (*GroupNew_G) ProtoMessage()    {}
+func (*GroupNew_G) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{26, 0}
+}
 func (m *GroupNew_G) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_GroupNew_G.Unmarshal(m, b)
 }
@@ -2844,10 +2928,12 @@ type FloatingPoint struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *FloatingPoint) Reset()                    { *m = FloatingPoint{} }
-func (m *FloatingPoint) String() string            { return proto.CompactTextString(m) }
-func (*FloatingPoint) ProtoMessage()               {}
-func (*FloatingPoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
+func (m *FloatingPoint) Reset()         { *m = FloatingPoint{} }
+func (m *FloatingPoint) String() string { return proto.CompactTextString(m) }
+func (*FloatingPoint) ProtoMessage()    {}
+func (*FloatingPoint) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{27}
+}
 func (m *FloatingPoint) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_FloatingPoint.Unmarshal(m, b)
 }
@@ -2890,10 +2976,12 @@ type MessageWithMap struct {
 	XXX_sizecache        int32                    `json:"-"`
 }
 
-func (m *MessageWithMap) Reset()                    { *m = MessageWithMap{} }
-func (m *MessageWithMap) String() string            { return proto.CompactTextString(m) }
-func (*MessageWithMap) ProtoMessage()               {}
-func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
+func (m *MessageWithMap) Reset()         { *m = MessageWithMap{} }
+func (m *MessageWithMap) String() string { return proto.CompactTextString(m) }
+func (*MessageWithMap) ProtoMessage()    {}
+func (*MessageWithMap) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{28}
+}
 func (m *MessageWithMap) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_MessageWithMap.Unmarshal(m, b)
 }
@@ -2968,10 +3056,12 @@ type Oneof struct {
 	XXX_sizecache        int32           `json:"-"`
 }
 
-func (m *Oneof) Reset()                    { *m = Oneof{} }
-func (m *Oneof) String() string            { return proto.CompactTextString(m) }
-func (*Oneof) ProtoMessage()               {}
-func (*Oneof) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
+func (m *Oneof) Reset()         { *m = Oneof{} }
+func (m *Oneof) String() string { return proto.CompactTextString(m) }
+func (*Oneof) ProtoMessage()    {}
+func (*Oneof) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{29}
+}
 func (m *Oneof) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Oneof.Unmarshal(m, b)
 }
@@ -3533,10 +3623,12 @@ type Oneof_F_Group struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Oneof_F_Group) Reset()                    { *m = Oneof_F_Group{} }
-func (m *Oneof_F_Group) String() string            { return proto.CompactTextString(m) }
-func (*Oneof_F_Group) ProtoMessage()               {}
-func (*Oneof_F_Group) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29, 0} }
+func (m *Oneof_F_Group) Reset()         { *m = Oneof_F_Group{} }
+func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) }
+func (*Oneof_F_Group) ProtoMessage()    {}
+func (*Oneof_F_Group) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{29, 0}
+}
 func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b)
 }
@@ -3579,10 +3671,12 @@ type Communique struct {
 	XXX_sizecache        int32              `json:"-"`
 }
 
-func (m *Communique) Reset()                    { *m = Communique{} }
-func (m *Communique) String() string            { return proto.CompactTextString(m) }
-func (*Communique) ProtoMessage()               {}
-func (*Communique) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
+func (m *Communique) Reset()         { *m = Communique{} }
+func (m *Communique) String() string { return proto.CompactTextString(m) }
+func (*Communique) ProtoMessage()    {}
+func (*Communique) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_e5ec025d2ec4e5d0, []int{30}
+}
 func (m *Communique) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Communique.Unmarshal(m, b)
 }
@@ -4724,9 +4818,9 @@ func init() {
 	proto.RegisterExtension(E_X250)
 }
 
-func init() { proto.RegisterFile("test.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("test.proto", fileDescriptor_test_e5ec025d2ec4e5d0) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_test_e5ec025d2ec4e5d0 = []byte{
 	// 4644 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0xd9, 0x73, 0x1b, 0x47,
 	0x7a, 0xd7, 0x0c, 0xee, 0x0f, 0x20, 0x31, 0x6c, 0xd1, 0x12, 0x44, 0x59, 0xd2, 0x08, 0x6b, 0xaf,

+ 41 - 14
protoc-gen-go/generator/generator.go

@@ -40,6 +40,8 @@ import (
 	"bufio"
 	"bytes"
 	"compress/gzip"
+	"crypto/sha256"
+	"encoding/hex"
 	"fmt"
 	"go/parser"
 	"go/printer"
@@ -258,7 +260,7 @@ type FileDescriptor struct {
 	// This is used for supporting public imports.
 	exported map[Object][]symbol
 
-	index int // The index of this file in the list of files to generate code for
+	fingerprint string // Fingerprint of this file's contents.
 
 	proto3 bool // whether to generate proto3 code for this file
 }
@@ -269,7 +271,10 @@ func (d *FileDescriptor) PackageName() string { return uniquePackageOf(d.FileDes
 // VarName is the variable name we'll use in the generated code to refer
 // to the compressed bytes of this descriptor. It is not exported, so
 // it is only valid inside the generated package.
-func (d *FileDescriptor) VarName() string { return fmt.Sprintf("fileDescriptor%d", d.index) }
+func (d *FileDescriptor) VarName() string {
+	name := strings.Map(badToUnderscore, baseName(d.GetName()))
+	return fmt.Sprintf("fileDescriptor_%s_%s", name, d.fingerprint)
+}
 
 // goPackageOption interprets the file's go_package option.
 // If there is no go_package, it returns ("", "", false).
@@ -847,11 +852,27 @@ func (g *Generator) WrapTypes() {
 		if fd == nil {
 			g.Fail("could not find file named", fileName)
 		}
-		fd.index = len(g.genFiles)
+		fingerprint, err := fingerprintProto(fd.FileDescriptorProto)
+		if err != nil {
+			g.Error(err)
+		}
+		fd.fingerprint = fingerprint
 		g.genFiles = append(g.genFiles, fd)
 	}
 }
 
+// fingerprintProto returns a fingerprint for a message.
+// The fingerprint is intended to prevent conflicts between generated fileds,
+// not to provide cryptographic security.
+func fingerprintProto(m proto.Message) (string, error) {
+	b, err := proto.Marshal(m)
+	if err != nil {
+		return "", err
+	}
+	h := sha256.Sum256(b)
+	return hex.EncodeToString(h[:8]), nil
+}
+
 // Scan the descriptors in this file.  For each one, build the slice of nested descriptors
 func (g *Generator) buildNestedDescriptors(descs []*Descriptor) {
 	for _, desc := range descs {
@@ -1237,15 +1258,13 @@ func (g *Generator) generate(file *FileDescriptor) {
 	g.file = g.FileOf(file.FileDescriptorProto)
 	g.usedPackages = make(map[string]bool)
 
-	if g.file.index == 0 {
-		// For one file in the package, assert version compatibility.
-		g.P("// This is a compile-time assertion to ensure that this generated file")
-		g.P("// is compatible with the proto package it is being compiled against.")
-		g.P("// A compilation error at this line likely means your copy of the")
-		g.P("// proto package needs to be updated.")
-		g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package")
-		g.P()
-	}
+	g.P("// This is a compile-time assertion to ensure that this generated file")
+	g.P("// is compatible with the proto package it is being compiled against.")
+	g.P("// A compilation error at this line likely means your copy of the")
+	g.P("// proto package needs to be updated.")
+	g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package")
+	g.P()
+
 	for _, td := range g.file.imp {
 		g.generateImported(td)
 	}
@@ -1561,7 +1580,11 @@ func (g *Generator) generateEnum(enum *EnumDescriptor) {
 		indexes = append([]string{strconv.Itoa(m.index)}, indexes...)
 	}
 	indexes = append(indexes, strconv.Itoa(enum.index))
-	g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }")
+	g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) {")
+	g.In()
+	g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}")
+	g.Out()
+	g.P("}")
 	if enum.file.GetPackage() == "google.protobuf" && enum.GetName() == "NullValue" {
 		g.P("func (", ccTypeName, `) XXX_WellKnownType() string { return "`, enum.GetName(), `" }`)
 	}
@@ -2037,7 +2060,11 @@ func (g *Generator) generateMessage(message *Descriptor) {
 	for m := message; m != nil; m = m.parent {
 		indexes = append([]string{strconv.Itoa(m.index)}, indexes...)
 	}
-	g.P("func (*", ccTypeName, ") Descriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }")
+	g.P("func (*", ccTypeName, ") Descriptor() ([]byte, []int) {")
+	g.In()
+	g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}")
+	g.Out()
+	g.P("}")
 	// TODO: Revisit the decision to use a XXX_WellKnownType method
 	// if we change proto.MessageName to work with multiple equivalents.
 	if message.file.GetPackage() == "google.protobuf" && wellKnownTypes[message.GetName()] {

+ 19 - 11
protoc-gen-go/testdata/deprecated/deprecated.pb.go

@@ -44,7 +44,9 @@ var DeprecatedEnum_value = map[string]int32{
 func (x DeprecatedEnum) String() string {
 	return proto.EnumName(DeprecatedEnum_name, int32(x))
 }
-func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_deprecated_9e1889ba21817fad, []int{0}
+}
 
 // DeprecatedRequest is a request to DeprecatedCall.
 //
@@ -55,10 +57,12 @@ type DeprecatedRequest struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *DeprecatedRequest) Reset()                    { *m = DeprecatedRequest{} }
-func (m *DeprecatedRequest) String() string            { return proto.CompactTextString(m) }
-func (*DeprecatedRequest) ProtoMessage()               {}
-func (*DeprecatedRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *DeprecatedRequest) Reset()         { *m = DeprecatedRequest{} }
+func (m *DeprecatedRequest) String() string { return proto.CompactTextString(m) }
+func (*DeprecatedRequest) ProtoMessage()    {}
+func (*DeprecatedRequest) Descriptor() ([]byte, []int) {
+	return fileDescriptor_deprecated_9e1889ba21817fad, []int{0}
+}
 func (m *DeprecatedRequest) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_DeprecatedRequest.Unmarshal(m, b)
 }
@@ -86,10 +90,12 @@ type DeprecatedResponse struct {
 	XXX_sizecache        int32          `json:"-"`
 }
 
-func (m *DeprecatedResponse) Reset()                    { *m = DeprecatedResponse{} }
-func (m *DeprecatedResponse) String() string            { return proto.CompactTextString(m) }
-func (*DeprecatedResponse) ProtoMessage()               {}
-func (*DeprecatedResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *DeprecatedResponse) Reset()         { *m = DeprecatedResponse{} }
+func (m *DeprecatedResponse) String() string { return proto.CompactTextString(m) }
+func (*DeprecatedResponse) ProtoMessage()    {}
+func (*DeprecatedResponse) Descriptor() ([]byte, []int) {
+	return fileDescriptor_deprecated_9e1889ba21817fad, []int{1}
+}
 func (m *DeprecatedResponse) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_DeprecatedResponse.Unmarshal(m, b)
 }
@@ -201,9 +207,11 @@ var _DeprecatedService_serviceDesc = grpc.ServiceDesc{
 	Metadata: "deprecated/deprecated.proto",
 }
 
-func init() { proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor0) }
+func init() {
+	proto.RegisterFile("deprecated/deprecated.proto", fileDescriptor_deprecated_9e1889ba21817fad)
+}
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_deprecated_9e1889ba21817fad = []byte{
 	// 248 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x49, 0x2d, 0x28,
 	0x4a, 0x4d, 0x4e, 0x2c, 0x49, 0x4d, 0xd1, 0x47, 0x30, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85,

+ 16 - 10
protoc-gen-go/testdata/extension_base/extension_base.pb.go

@@ -26,10 +26,12 @@ type BaseMessage struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *BaseMessage) Reset()                    { *m = BaseMessage{} }
-func (m *BaseMessage) String() string            { return proto.CompactTextString(m) }
-func (*BaseMessage) ProtoMessage()               {}
-func (*BaseMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *BaseMessage) Reset()         { *m = BaseMessage{} }
+func (m *BaseMessage) String() string { return proto.CompactTextString(m) }
+func (*BaseMessage) ProtoMessage()    {}
+func (*BaseMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_base_41d3c712c9fc37fc, []int{0}
+}
 
 var extRange_BaseMessage = []proto.ExtensionRange{
 	{4, 9},
@@ -72,10 +74,12 @@ type OldStyleMessage struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *OldStyleMessage) Reset()                    { *m = OldStyleMessage{} }
-func (m *OldStyleMessage) String() string            { return proto.CompactTextString(m) }
-func (*OldStyleMessage) ProtoMessage()               {}
-func (*OldStyleMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *OldStyleMessage) Reset()         { *m = OldStyleMessage{} }
+func (m *OldStyleMessage) String() string { return proto.CompactTextString(m) }
+func (*OldStyleMessage) ProtoMessage()    {}
+func (*OldStyleMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_base_41d3c712c9fc37fc, []int{1}
+}
 
 func (m *OldStyleMessage) MarshalJSON() ([]byte, error) {
 	return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
@@ -114,9 +118,11 @@ func init() {
 	proto.RegisterType((*OldStyleMessage)(nil), "extension_base.OldStyleMessage")
 }
 
-func init() { proto.RegisterFile("extension_base/extension_base.proto", fileDescriptor0) }
+func init() {
+	proto.RegisterFile("extension_base/extension_base.proto", fileDescriptor_extension_base_41d3c712c9fc37fc)
+}
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_extension_base_41d3c712c9fc37fc = []byte{
 	// 179 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xad, 0x28, 0x49,
 	0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x47, 0xe5, 0xea, 0x15, 0x14,

+ 10 - 6
protoc-gen-go/testdata/extension_extra/extension_extra.pb.go

@@ -25,10 +25,12 @@ type ExtraMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *ExtraMessage) Reset()                    { *m = ExtraMessage{} }
-func (m *ExtraMessage) String() string            { return proto.CompactTextString(m) }
-func (*ExtraMessage) ProtoMessage()               {}
-func (*ExtraMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *ExtraMessage) Reset()         { *m = ExtraMessage{} }
+func (m *ExtraMessage) String() string { return proto.CompactTextString(m) }
+func (*ExtraMessage) ProtoMessage()    {}
+func (*ExtraMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_extra_83adf2410f49f816, []int{0}
+}
 func (m *ExtraMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ExtraMessage.Unmarshal(m, b)
 }
@@ -58,9 +60,11 @@ func init() {
 	proto.RegisterType((*ExtraMessage)(nil), "extension_extra.ExtraMessage")
 }
 
-func init() { proto.RegisterFile("extension_extra/extension_extra.proto", fileDescriptor0) }
+func init() {
+	proto.RegisterFile("extension_extra/extension_extra.proto", fileDescriptor_extension_extra_83adf2410f49f816)
+}
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_extension_extra_83adf2410f49f816 = []byte{
 	// 133 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x28, 0x49,
 	0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x8b, 0x4f, 0xad, 0x28, 0x29, 0x4a, 0xd4, 0x47, 0xe3, 0xeb, 0x15,

+ 40 - 26
protoc-gen-go/testdata/extension_user/extension_user.pb.go

@@ -28,10 +28,12 @@ type UserMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *UserMessage) Reset()                    { *m = UserMessage{} }
-func (m *UserMessage) String() string            { return proto.CompactTextString(m) }
-func (*UserMessage) ProtoMessage()               {}
-func (*UserMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *UserMessage) Reset()         { *m = UserMessage{} }
+func (m *UserMessage) String() string { return proto.CompactTextString(m) }
+func (*UserMessage) ProtoMessage()    {}
+func (*UserMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{0}
+}
 func (m *UserMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_UserMessage.Unmarshal(m, b)
 }
@@ -72,10 +74,12 @@ type LoudMessage struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *LoudMessage) Reset()                    { *m = LoudMessage{} }
-func (m *LoudMessage) String() string            { return proto.CompactTextString(m) }
-func (*LoudMessage) ProtoMessage()               {}
-func (*LoudMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *LoudMessage) Reset()         { *m = LoudMessage{} }
+func (m *LoudMessage) String() string { return proto.CompactTextString(m) }
+func (*LoudMessage) ProtoMessage()    {}
+func (*LoudMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{1}
+}
 
 var extRange_LoudMessage = []proto.ExtensionRange{
 	{100, 536870911},
@@ -118,10 +122,12 @@ type LoginMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *LoginMessage) Reset()                    { *m = LoginMessage{} }
-func (m *LoginMessage) String() string            { return proto.CompactTextString(m) }
-func (*LoginMessage) ProtoMessage()               {}
-func (*LoginMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *LoginMessage) Reset()         { *m = LoginMessage{} }
+func (m *LoginMessage) String() string { return proto.CompactTextString(m) }
+func (*LoginMessage) ProtoMessage()    {}
+func (*LoginMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{2}
+}
 func (m *LoginMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_LoginMessage.Unmarshal(m, b)
 }
@@ -156,10 +162,12 @@ type Detail struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Detail) Reset()                    { *m = Detail{} }
-func (m *Detail) String() string            { return proto.CompactTextString(m) }
-func (*Detail) ProtoMessage()               {}
-func (*Detail) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *Detail) Reset()         { *m = Detail{} }
+func (m *Detail) String() string { return proto.CompactTextString(m) }
+func (*Detail) ProtoMessage()    {}
+func (*Detail) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{3}
+}
 func (m *Detail) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Detail.Unmarshal(m, b)
 }
@@ -193,10 +201,12 @@ type Announcement struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Announcement) Reset()                    { *m = Announcement{} }
-func (m *Announcement) String() string            { return proto.CompactTextString(m) }
-func (*Announcement) ProtoMessage()               {}
-func (*Announcement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
+func (m *Announcement) Reset()         { *m = Announcement{} }
+func (m *Announcement) String() string { return proto.CompactTextString(m) }
+func (*Announcement) ProtoMessage()    {}
+func (*Announcement) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{4}
+}
 func (m *Announcement) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Announcement.Unmarshal(m, b)
 }
@@ -240,10 +250,12 @@ type OldStyleParcel struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *OldStyleParcel) Reset()                    { *m = OldStyleParcel{} }
-func (m *OldStyleParcel) String() string            { return proto.CompactTextString(m) }
-func (*OldStyleParcel) ProtoMessage()               {}
-func (*OldStyleParcel) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+func (m *OldStyleParcel) Reset()         { *m = OldStyleParcel{} }
+func (m *OldStyleParcel) String() string { return proto.CompactTextString(m) }
+func (*OldStyleParcel) ProtoMessage()    {}
+func (*OldStyleParcel) Descriptor() ([]byte, []int) {
+	return fileDescriptor_extension_user_af41b5e0bdfb7846, []int{5}
+}
 func (m *OldStyleParcel) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_OldStyleParcel.Unmarshal(m, b)
 }
@@ -348,9 +360,11 @@ func init() {
 	proto.RegisterExtension(E_Detail)
 }
 
-func init() { proto.RegisterFile("extension_user/extension_user.proto", fileDescriptor0) }
+func init() {
+	proto.RegisterFile("extension_user/extension_user.proto", fileDescriptor_extension_user_af41b5e0bdfb7846)
+}
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_extension_user_af41b5e0bdfb7846 = []byte{
 	// 492 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x6f, 0x94, 0x40,
 	0x10, 0x0e, 0x6d, 0x8f, 0x5e, 0x87, 0x6b, 0xad, 0xa8, 0xcd, 0xa5, 0x6a, 0x25, 0x18, 0x13, 0x62,

+ 26 - 18
protoc-gen-go/testdata/grpc/grpc.pb.go

@@ -29,10 +29,12 @@ type SimpleRequest struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *SimpleRequest) Reset()                    { *m = SimpleRequest{} }
-func (m *SimpleRequest) String() string            { return proto.CompactTextString(m) }
-func (*SimpleRequest) ProtoMessage()               {}
-func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *SimpleRequest) Reset()         { *m = SimpleRequest{} }
+func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
+func (*SimpleRequest) ProtoMessage()    {}
+func (*SimpleRequest) Descriptor() ([]byte, []int) {
+	return fileDescriptor_grpc_65bf3902e49ee873, []int{0}
+}
 func (m *SimpleRequest) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_SimpleRequest.Unmarshal(m, b)
 }
@@ -57,10 +59,12 @@ type SimpleResponse struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *SimpleResponse) Reset()                    { *m = SimpleResponse{} }
-func (m *SimpleResponse) String() string            { return proto.CompactTextString(m) }
-func (*SimpleResponse) ProtoMessage()               {}
-func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *SimpleResponse) Reset()         { *m = SimpleResponse{} }
+func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
+func (*SimpleResponse) ProtoMessage()    {}
+func (*SimpleResponse) Descriptor() ([]byte, []int) {
+	return fileDescriptor_grpc_65bf3902e49ee873, []int{1}
+}
 func (m *SimpleResponse) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_SimpleResponse.Unmarshal(m, b)
 }
@@ -85,10 +89,12 @@ type StreamMsg struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *StreamMsg) Reset()                    { *m = StreamMsg{} }
-func (m *StreamMsg) String() string            { return proto.CompactTextString(m) }
-func (*StreamMsg) ProtoMessage()               {}
-func (*StreamMsg) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *StreamMsg) Reset()         { *m = StreamMsg{} }
+func (m *StreamMsg) String() string { return proto.CompactTextString(m) }
+func (*StreamMsg) ProtoMessage()    {}
+func (*StreamMsg) Descriptor() ([]byte, []int) {
+	return fileDescriptor_grpc_65bf3902e49ee873, []int{2}
+}
 func (m *StreamMsg) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_StreamMsg.Unmarshal(m, b)
 }
@@ -113,10 +119,12 @@ type StreamMsg2 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *StreamMsg2) Reset()                    { *m = StreamMsg2{} }
-func (m *StreamMsg2) String() string            { return proto.CompactTextString(m) }
-func (*StreamMsg2) ProtoMessage()               {}
-func (*StreamMsg2) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *StreamMsg2) Reset()         { *m = StreamMsg2{} }
+func (m *StreamMsg2) String() string { return proto.CompactTextString(m) }
+func (*StreamMsg2) ProtoMessage()    {}
+func (*StreamMsg2) Descriptor() ([]byte, []int) {
+	return fileDescriptor_grpc_65bf3902e49ee873, []int{3}
+}
 func (m *StreamMsg2) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_StreamMsg2.Unmarshal(m, b)
 }
@@ -413,9 +421,9 @@ var _Test_serviceDesc = grpc.ServiceDesc{
 	Metadata: "grpc/grpc.proto",
 }
 
-func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_grpc_65bf3902e49ee873) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_grpc_65bf3902e49ee873 = []byte{
 	// 244 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48,
 	0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71,

+ 23 - 15
protoc-gen-go/testdata/imp/imp.pb.go

@@ -50,7 +50,9 @@ func (x *ImportedMessage_Owner) UnmarshalJSON(data []byte) error {
 	*x = ImportedMessage_Owner(value)
 	return nil
 }
-func (ImportedMessage_Owner) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
+func (ImportedMessage_Owner) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_imp_81275c260ac30f8b, []int{0, 0}
+}
 
 type ImportedMessage struct {
 	Field *int64 `protobuf:"varint,1,req,name=field" json:"field,omitempty"`
@@ -71,10 +73,12 @@ type ImportedMessage struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *ImportedMessage) Reset()                    { *m = ImportedMessage{} }
-func (m *ImportedMessage) String() string            { return proto.CompactTextString(m) }
-func (*ImportedMessage) ProtoMessage()               {}
-func (*ImportedMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *ImportedMessage) Reset()         { *m = ImportedMessage{} }
+func (m *ImportedMessage) String() string { return proto.CompactTextString(m) }
+func (*ImportedMessage) ProtoMessage()    {}
+func (*ImportedMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_imp_81275c260ac30f8b, []int{0}
+}
 
 var extRange_ImportedMessage = []proto.ExtensionRange{
 	{90, 100},
@@ -237,10 +241,12 @@ type ImportedMessage2 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *ImportedMessage2) Reset()                    { *m = ImportedMessage2{} }
-func (m *ImportedMessage2) String() string            { return proto.CompactTextString(m) }
-func (*ImportedMessage2) ProtoMessage()               {}
-func (*ImportedMessage2) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *ImportedMessage2) Reset()         { *m = ImportedMessage2{} }
+func (m *ImportedMessage2) String() string { return proto.CompactTextString(m) }
+func (*ImportedMessage2) ProtoMessage()    {}
+func (*ImportedMessage2) Descriptor() ([]byte, []int) {
+	return fileDescriptor_imp_81275c260ac30f8b, []int{1}
+}
 func (m *ImportedMessage2) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ImportedMessage2.Unmarshal(m, b)
 }
@@ -266,10 +272,12 @@ type ImportedExtendable struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *ImportedExtendable) Reset()                    { *m = ImportedExtendable{} }
-func (m *ImportedExtendable) String() string            { return proto.CompactTextString(m) }
-func (*ImportedExtendable) ProtoMessage()               {}
-func (*ImportedExtendable) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *ImportedExtendable) Reset()         { *m = ImportedExtendable{} }
+func (m *ImportedExtendable) String() string { return proto.CompactTextString(m) }
+func (*ImportedExtendable) ProtoMessage()    {}
+func (*ImportedExtendable) Descriptor() ([]byte, []int) {
+	return fileDescriptor_imp_81275c260ac30f8b, []int{2}
+}
 
 func (m *ImportedExtendable) MarshalJSON() ([]byte, error) {
 	return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
@@ -311,9 +319,9 @@ func init() {
 	proto.RegisterEnum("imp.ImportedMessage_Owner", ImportedMessage_Owner_name, ImportedMessage_Owner_value)
 }
 
-func init() { proto.RegisterFile("imp/imp.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("imp/imp.proto", fileDescriptor_imp_81275c260ac30f8b) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_imp_81275c260ac30f8b = []byte{
 	// 421 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x8b, 0xd4, 0x30,
 	0x18, 0xc6, 0x4d, 0xff, 0xec, 0xb4, 0xef, 0xe0, 0x5a, 0x82, 0x4a, 0x99, 0xbd, 0x84, 0x9e, 0xea,

+ 17 - 7
protoc-gen-go/testdata/imp/imp2.pb.go

@@ -12,6 +12,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type PubliclyImportedEnum int32
 
 const (
@@ -44,7 +50,9 @@ func (x *PubliclyImportedEnum) UnmarshalJSON(data []byte) error {
 	*x = PubliclyImportedEnum(value)
 	return nil
 }
-func (PubliclyImportedEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (PubliclyImportedEnum) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_imp2_dcbceb16a8ff78d7, []int{0}
+}
 
 type PubliclyImportedMessage struct {
 	Field                *int64   `protobuf:"varint,1,opt,name=field" json:"field,omitempty"`
@@ -53,10 +61,12 @@ type PubliclyImportedMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *PubliclyImportedMessage) Reset()                    { *m = PubliclyImportedMessage{} }
-func (m *PubliclyImportedMessage) String() string            { return proto.CompactTextString(m) }
-func (*PubliclyImportedMessage) ProtoMessage()               {}
-func (*PubliclyImportedMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *PubliclyImportedMessage) Reset()         { *m = PubliclyImportedMessage{} }
+func (m *PubliclyImportedMessage) String() string { return proto.CompactTextString(m) }
+func (*PubliclyImportedMessage) ProtoMessage()    {}
+func (*PubliclyImportedMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_imp2_dcbceb16a8ff78d7, []int{0}
+}
 func (m *PubliclyImportedMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_PubliclyImportedMessage.Unmarshal(m, b)
 }
@@ -87,9 +97,9 @@ func init() {
 	proto.RegisterEnum("imp.PubliclyImportedEnum", PubliclyImportedEnum_name, PubliclyImportedEnum_value)
 }
 
-func init() { proto.RegisterFile("imp/imp2.proto", fileDescriptor1) }
+func init() { proto.RegisterFile("imp/imp2.proto", fileDescriptor_imp2_dcbceb16a8ff78d7) }
 
-var fileDescriptor1 = []byte{
+var fileDescriptor_imp2_dcbceb16a8ff78d7 = []byte{
 	// 171 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0xcc, 0x2d, 0xd0,
 	0xcf, 0xcc, 0x2d, 0x30, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xce, 0xcc, 0x2d, 0x50,

+ 14 - 6
protoc-gen-go/testdata/imp/imp3.pb.go

@@ -12,6 +12,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type ForeignImportedMessage struct {
 	Tuber                *string  `protobuf:"bytes,1,opt,name=tuber" json:"tuber,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -19,10 +25,12 @@ type ForeignImportedMessage struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *ForeignImportedMessage) Reset()                    { *m = ForeignImportedMessage{} }
-func (m *ForeignImportedMessage) String() string            { return proto.CompactTextString(m) }
-func (*ForeignImportedMessage) ProtoMessage()               {}
-func (*ForeignImportedMessage) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
+func (m *ForeignImportedMessage) Reset()         { *m = ForeignImportedMessage{} }
+func (m *ForeignImportedMessage) String() string { return proto.CompactTextString(m) }
+func (*ForeignImportedMessage) ProtoMessage()    {}
+func (*ForeignImportedMessage) Descriptor() ([]byte, []int) {
+	return fileDescriptor_imp3_dbacc1715de7e782, []int{0}
+}
 func (m *ForeignImportedMessage) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ForeignImportedMessage.Unmarshal(m, b)
 }
@@ -52,9 +60,9 @@ func init() {
 	proto.RegisterType((*ForeignImportedMessage)(nil), "imp.ForeignImportedMessage")
 }
 
-func init() { proto.RegisterFile("imp/imp3.proto", fileDescriptor2) }
+func init() { proto.RegisterFile("imp/imp3.proto", fileDescriptor_imp3_dbacc1715de7e782) }
 
-var fileDescriptor2 = []byte{
+var fileDescriptor_imp3_dbacc1715de7e782 = []byte{
 	// 137 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0xcc, 0x2d, 0xd0,
 	0xcf, 0xcc, 0x2d, 0x30, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xce, 0xcc, 0x2d, 0x50,

+ 8 - 6
protoc-gen-go/testdata/imports/fmt/m.pb.go

@@ -24,10 +24,12 @@ type M struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *M) Reset()                    { *m = M{} }
-func (m *M) String() string            { return proto.CompactTextString(m) }
-func (*M) ProtoMessage()               {}
-func (*M) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *M) Reset()         { *m = M{} }
+func (m *M) String() string { return proto.CompactTextString(m) }
+func (*M) ProtoMessage()    {}
+func (*M) Descriptor() ([]byte, []int) {
+	return fileDescriptor_m_867dd34c461422b8, []int{0}
+}
 func (m *M) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_M.Unmarshal(m, b)
 }
@@ -50,9 +52,9 @@ func init() {
 	proto.RegisterType((*M)(nil), "fmt.M")
 }
 
-func init() { proto.RegisterFile("imports/fmt/m.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("imports/fmt/m.proto", fileDescriptor_m_867dd34c461422b8) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_m_867dd34c461422b8 = []byte{
 	// 109 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xce, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x4f, 0xcb, 0x2d, 0xd1, 0xcf, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,

+ 8 - 6
protoc-gen-go/testdata/imports/test_a_1/m1.pb.go

@@ -24,10 +24,12 @@ type M1 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *M1) Reset()                    { *m = M1{} }
-func (m *M1) String() string            { return proto.CompactTextString(m) }
-func (*M1) ProtoMessage()               {}
-func (*M1) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *M1) Reset()         { *m = M1{} }
+func (m *M1) String() string { return proto.CompactTextString(m) }
+func (*M1) ProtoMessage()    {}
+func (*M1) Descriptor() ([]byte, []int) {
+	return fileDescriptor_m1_4abc85f8d0361bef, []int{0}
+}
 func (m *M1) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_M1.Unmarshal(m, b)
 }
@@ -50,9 +52,9 @@ func init() {
 	proto.RegisterType((*M1)(nil), "test.a.M1")
 }
 
-func init() { proto.RegisterFile("imports/test_a_1/m1.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("imports/test_a_1/m1.proto", fileDescriptor_m1_4abc85f8d0361bef) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_m1_4abc85f8d0361bef = []byte{
 	// 114 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd4, 0xcf, 0x35, 0xd4,

+ 14 - 6
protoc-gen-go/testdata/imports/test_a_1/m2.pb.go

@@ -12,16 +12,24 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type M2 struct {
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *M2) Reset()                    { *m = M2{} }
-func (m *M2) String() string            { return proto.CompactTextString(m) }
-func (*M2) ProtoMessage()               {}
-func (*M2) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *M2) Reset()         { *m = M2{} }
+func (m *M2) String() string { return proto.CompactTextString(m) }
+func (*M2) ProtoMessage()    {}
+func (*M2) Descriptor() ([]byte, []int) {
+	return fileDescriptor_m2_ccd6356c045a9ac3, []int{0}
+}
 func (m *M2) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_M2.Unmarshal(m, b)
 }
@@ -44,9 +52,9 @@ func init() {
 	proto.RegisterType((*M2)(nil), "test.a.M2")
 }
 
-func init() { proto.RegisterFile("imports/test_a_1/m2.proto", fileDescriptor1) }
+func init() { proto.RegisterFile("imports/test_a_1/m2.proto", fileDescriptor_m2_ccd6356c045a9ac3) }
 
-var fileDescriptor1 = []byte{
+var fileDescriptor_m2_ccd6356c045a9ac3 = []byte{
 	// 114 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd4, 0xcf, 0x35, 0xd2,

+ 8 - 6
protoc-gen-go/testdata/imports/test_a_2/m3.pb.go

@@ -24,10 +24,12 @@ type M3 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *M3) Reset()                    { *m = M3{} }
-func (m *M3) String() string            { return proto.CompactTextString(m) }
-func (*M3) ProtoMessage()               {}
-func (*M3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *M3) Reset()         { *m = M3{} }
+func (m *M3) String() string { return proto.CompactTextString(m) }
+func (*M3) ProtoMessage()    {}
+func (*M3) Descriptor() ([]byte, []int) {
+	return fileDescriptor_m3_de310e87d08d4216, []int{0}
+}
 func (m *M3) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_M3.Unmarshal(m, b)
 }
@@ -50,9 +52,9 @@ func init() {
 	proto.RegisterType((*M3)(nil), "test.a.M3")
 }
 
-func init() { proto.RegisterFile("imports/test_a_2/m3.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("imports/test_a_2/m3.proto", fileDescriptor_m3_de310e87d08d4216) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_m3_de310e87d08d4216 = []byte{
 	// 114 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd2, 0xcf, 0x35, 0xd6,

+ 14 - 6
protoc-gen-go/testdata/imports/test_a_2/m4.pb.go

@@ -12,16 +12,24 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type M4 struct {
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *M4) Reset()                    { *m = M4{} }
-func (m *M4) String() string            { return proto.CompactTextString(m) }
-func (*M4) ProtoMessage()               {}
-func (*M4) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *M4) Reset()         { *m = M4{} }
+func (m *M4) String() string { return proto.CompactTextString(m) }
+func (*M4) ProtoMessage()    {}
+func (*M4) Descriptor() ([]byte, []int) {
+	return fileDescriptor_m4_da12b386229f3791, []int{0}
+}
 func (m *M4) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_M4.Unmarshal(m, b)
 }
@@ -44,9 +52,9 @@ func init() {
 	proto.RegisterType((*M4)(nil), "test.a.M4")
 }
 
-func init() { proto.RegisterFile("imports/test_a_2/m4.proto", fileDescriptor1) }
+func init() { proto.RegisterFile("imports/test_a_2/m4.proto", fileDescriptor_m4_da12b386229f3791) }
 
-var fileDescriptor1 = []byte{
+var fileDescriptor_m4_da12b386229f3791 = []byte{
 	// 114 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8c, 0x37, 0xd2, 0xcf, 0x35, 0xd1,

+ 8 - 6
protoc-gen-go/testdata/imports/test_b_1/m1.pb.go

@@ -24,10 +24,12 @@ type M1 struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *M1) Reset()                    { *m = M1{} }
-func (m *M1) String() string            { return proto.CompactTextString(m) }
-func (*M1) ProtoMessage()               {}
-func (*M1) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *M1) Reset()         { *m = M1{} }
+func (m *M1) String() string { return proto.CompactTextString(m) }
+func (*M1) ProtoMessage()    {}
+func (*M1) Descriptor() ([]byte, []int) {
+	return fileDescriptor_m1_aff127b054aec649, []int{0}
+}
 func (m *M1) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_M1.Unmarshal(m, b)
 }
@@ -50,9 +52,9 @@ func init() {
 	proto.RegisterType((*M1)(nil), "test.b.part1.M1")
 }
 
-func init() { proto.RegisterFile("imports/test_b_1/m1.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("imports/test_b_1/m1.proto", fileDescriptor_m1_aff127b054aec649) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_m1_aff127b054aec649 = []byte{
 	// 125 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8a, 0x37, 0xd4, 0xcf, 0x35, 0xd4,

+ 14 - 6
protoc-gen-go/testdata/imports/test_b_1/m2.pb.go

@@ -12,16 +12,24 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type M2 struct {
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *M2) Reset()                    { *m = M2{} }
-func (m *M2) String() string            { return proto.CompactTextString(m) }
-func (*M2) ProtoMessage()               {}
-func (*M2) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *M2) Reset()         { *m = M2{} }
+func (m *M2) String() string { return proto.CompactTextString(m) }
+func (*M2) ProtoMessage()    {}
+func (*M2) Descriptor() ([]byte, []int) {
+	return fileDescriptor_m2_0c59cab35ba1b0d8, []int{0}
+}
 func (m *M2) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_M2.Unmarshal(m, b)
 }
@@ -44,9 +52,9 @@ func init() {
 	proto.RegisterType((*M2)(nil), "test.b.part2.M2")
 }
 
-func init() { proto.RegisterFile("imports/test_b_1/m2.proto", fileDescriptor1) }
+func init() { proto.RegisterFile("imports/test_b_1/m2.proto", fileDescriptor_m2_0c59cab35ba1b0d8) }
 
-var fileDescriptor1 = []byte{
+var fileDescriptor_m2_0c59cab35ba1b0d8 = []byte{
 	// 125 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x4f, 0x8a, 0x37, 0xd4, 0xcf, 0x35, 0xd2,

+ 10 - 6
protoc-gen-go/testdata/imports/test_import_a1m1.pb.go

@@ -26,10 +26,12 @@ type A1M1 struct {
 	XXX_sizecache        int32      `json:"-"`
 }
 
-func (m *A1M1) Reset()                    { *m = A1M1{} }
-func (m *A1M1) String() string            { return proto.CompactTextString(m) }
-func (*A1M1) ProtoMessage()               {}
-func (*A1M1) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *A1M1) Reset()         { *m = A1M1{} }
+func (m *A1M1) String() string { return proto.CompactTextString(m) }
+func (*A1M1) ProtoMessage()    {}
+func (*A1M1) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_import_a1m1_d7f2b5c638a69f6e, []int{0}
+}
 func (m *A1M1) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_A1M1.Unmarshal(m, b)
 }
@@ -59,9 +61,11 @@ func init() {
 	proto.RegisterType((*A1M1)(nil), "test.A1M1")
 }
 
-func init() { proto.RegisterFile("imports/test_import_a1m1.proto", fileDescriptor0) }
+func init() {
+	proto.RegisterFile("imports/test_import_a1m1.proto", fileDescriptor_test_import_a1m1_d7f2b5c638a69f6e)
+}
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_test_import_a1m1_d7f2b5c638a69f6e = []byte{
 	// 149 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x87, 0x70, 0xe2, 0x13, 0x0d, 0x73, 0x0d,

+ 16 - 6
protoc-gen-go/testdata/imports/test_import_a1m2.pb.go

@@ -13,6 +13,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type A1M2 struct {
 	F                    *test_a1.M2 `protobuf:"bytes,1,opt,name=f" json:"f,omitempty"`
 	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
@@ -20,10 +26,12 @@ type A1M2 struct {
 	XXX_sizecache        int32       `json:"-"`
 }
 
-func (m *A1M2) Reset()                    { *m = A1M2{} }
-func (m *A1M2) String() string            { return proto.CompactTextString(m) }
-func (*A1M2) ProtoMessage()               {}
-func (*A1M2) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *A1M2) Reset()         { *m = A1M2{} }
+func (m *A1M2) String() string { return proto.CompactTextString(m) }
+func (*A1M2) ProtoMessage()    {}
+func (*A1M2) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_import_a1m2_9a3281ce9464e116, []int{0}
+}
 func (m *A1M2) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_A1M2.Unmarshal(m, b)
 }
@@ -53,9 +61,11 @@ func init() {
 	proto.RegisterType((*A1M2)(nil), "test.A1M2")
 }
 
-func init() { proto.RegisterFile("imports/test_import_a1m2.proto", fileDescriptor1) }
+func init() {
+	proto.RegisterFile("imports/test_import_a1m2.proto", fileDescriptor_test_import_a1m2_9a3281ce9464e116)
+}
 
-var fileDescriptor1 = []byte{
+var fileDescriptor_test_import_a1m2_9a3281ce9464e116 = []byte{
 	// 149 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x87, 0x70, 0xe2, 0x13, 0x0d, 0x73, 0x8d,

+ 16 - 6
protoc-gen-go/testdata/imports/test_import_all.pb.go

@@ -19,6 +19,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type All struct {
 	Am1                  *test_a.M1       `protobuf:"bytes,1,opt,name=am1" json:"am1,omitempty"`
 	Am2                  *test_a1.M2      `protobuf:"bytes,2,opt,name=am2" json:"am2,omitempty"`
@@ -32,10 +38,12 @@ type All struct {
 	XXX_sizecache        int32            `json:"-"`
 }
 
-func (m *All) Reset()                    { *m = All{} }
-func (m *All) String() string            { return proto.CompactTextString(m) }
-func (*All) ProtoMessage()               {}
-func (*All) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
+func (m *All) Reset()         { *m = All{} }
+func (m *All) String() string { return proto.CompactTextString(m) }
+func (*All) ProtoMessage()    {}
+func (*All) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_import_all_b41dc4592e4a4f3b, []int{0}
+}
 func (m *All) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_All.Unmarshal(m, b)
 }
@@ -107,9 +115,11 @@ func init() {
 	proto.RegisterType((*All)(nil), "test.All")
 }
 
-func init() { proto.RegisterFile("imports/test_import_all.proto", fileDescriptor2) }
+func init() {
+	proto.RegisterFile("imports/test_import_all.proto", fileDescriptor_test_import_all_b41dc4592e4a4f3b)
+}
 
-var fileDescriptor2 = []byte{
+var fileDescriptor_test_import_all_b41dc4592e4a4f3b = []byte{
 	// 258 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0xd0, 0xb1, 0x4e, 0xc3, 0x30,
 	0x10, 0x06, 0x60, 0x15, 0x97, 0x20, 0x99, 0x05, 0x85, 0xc5, 0x20, 0x90, 0x50, 0x27, 0x96, 0xda,

+ 16 - 6
protoc-gen-go/testdata/imports/test_import_public.pb.go

@@ -13,6 +13,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 // M1 from public import imports/test_a_1/m1.proto
 type M1 test_a.M1
 
@@ -33,10 +39,12 @@ type Public struct {
 	XXX_sizecache        int32      `json:"-"`
 }
 
-func (m *Public) Reset()                    { *m = Public{} }
-func (m *Public) String() string            { return proto.CompactTextString(m) }
-func (*Public) ProtoMessage()               {}
-func (*Public) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
+func (m *Public) Reset()         { *m = Public{} }
+func (m *Public) String() string { return proto.CompactTextString(m) }
+func (*Public) ProtoMessage()    {}
+func (*Public) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_import_public_592f461eca0812f7, []int{0}
+}
 func (m *Public) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Public.Unmarshal(m, b)
 }
@@ -66,9 +74,11 @@ func init() {
 	proto.RegisterType((*Public)(nil), "test.Public")
 }
 
-func init() { proto.RegisterFile("imports/test_import_public.proto", fileDescriptor3) }
+func init() {
+	proto.RegisterFile("imports/test_import_public.proto", fileDescriptor_test_import_public_592f461eca0812f7)
+}
 
-var fileDescriptor3 = []byte{
+var fileDescriptor_test_import_public_592f461eca0812f7 = []byte{
 	// 154 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0xcc, 0x2d, 0xc8,
 	0x2f, 0x2a, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, 0x89, 0x87, 0x70, 0xe2, 0x0b, 0x4a, 0x93, 0x72,

+ 8 - 6
protoc-gen-go/testdata/multi/multi1.pb.go

@@ -27,10 +27,12 @@ type Multi1 struct {
 	XXX_sizecache        int32           `json:"-"`
 }
 
-func (m *Multi1) Reset()                    { *m = Multi1{} }
-func (m *Multi1) String() string            { return proto.CompactTextString(m) }
-func (*Multi1) ProtoMessage()               {}
-func (*Multi1) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *Multi1) Reset()         { *m = Multi1{} }
+func (m *Multi1) String() string { return proto.CompactTextString(m) }
+func (*Multi1) ProtoMessage()    {}
+func (*Multi1) Descriptor() ([]byte, []int) {
+	return fileDescriptor_multi1_08e50c6822e808b8, []int{0}
+}
 func (m *Multi1) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Multi1.Unmarshal(m, b)
 }
@@ -74,9 +76,9 @@ func init() {
 	proto.RegisterType((*Multi1)(nil), "multitest.Multi1")
 }
 
-func init() { proto.RegisterFile("multi/multi1.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("multi/multi1.proto", fileDescriptor_multi1_08e50c6822e808b8) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_multi1_08e50c6822e808b8 = []byte{
 	// 200 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29,
 	0xc9, 0xd4, 0x07, 0x93, 0x86, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49,

+ 17 - 7
protoc-gen-go/testdata/multi/multi2.pb.go

@@ -12,6 +12,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type Multi2_Color int32
 
 const (
@@ -47,7 +53,9 @@ func (x *Multi2_Color) UnmarshalJSON(data []byte) error {
 	*x = Multi2_Color(value)
 	return nil
 }
-func (Multi2_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} }
+func (Multi2_Color) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_multi2_c47490ad66d93e67, []int{0, 0}
+}
 
 type Multi2 struct {
 	RequiredValue        *int32        `protobuf:"varint,1,req,name=required_value,json=requiredValue" json:"required_value,omitempty"`
@@ -57,10 +65,12 @@ type Multi2 struct {
 	XXX_sizecache        int32         `json:"-"`
 }
 
-func (m *Multi2) Reset()                    { *m = Multi2{} }
-func (m *Multi2) String() string            { return proto.CompactTextString(m) }
-func (*Multi2) ProtoMessage()               {}
-func (*Multi2) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
+func (m *Multi2) Reset()         { *m = Multi2{} }
+func (m *Multi2) String() string { return proto.CompactTextString(m) }
+func (*Multi2) ProtoMessage()    {}
+func (*Multi2) Descriptor() ([]byte, []int) {
+	return fileDescriptor_multi2_c47490ad66d93e67, []int{0}
+}
 func (m *Multi2) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Multi2.Unmarshal(m, b)
 }
@@ -98,9 +108,9 @@ func init() {
 	proto.RegisterEnum("multitest.Multi2_Color", Multi2_Color_name, Multi2_Color_value)
 }
 
-func init() { proto.RegisterFile("multi/multi2.proto", fileDescriptor1) }
+func init() { proto.RegisterFile("multi/multi2.proto", fileDescriptor_multi2_c47490ad66d93e67) }
 
-var fileDescriptor1 = []byte{
+var fileDescriptor_multi2_c47490ad66d93e67 = []byte{
 	// 202 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29,
 	0xc9, 0xd4, 0x07, 0x93, 0x46, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49,

+ 17 - 7
protoc-gen-go/testdata/multi/multi3.pb.go

@@ -12,6 +12,12 @@ var _ = proto.Marshal
 var _ = fmt.Errorf
 var _ = math.Inf
 
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+
 type Multi3_HatType int32
 
 const (
@@ -44,7 +50,9 @@ func (x *Multi3_HatType) UnmarshalJSON(data []byte) error {
 	*x = Multi3_HatType(value)
 	return nil
 }
-func (Multi3_HatType) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{0, 0} }
+func (Multi3_HatType) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_multi3_d55a72b4628b7875, []int{0, 0}
+}
 
 type Multi3 struct {
 	HatType              *Multi3_HatType `protobuf:"varint,1,opt,name=hat_type,json=hatType,enum=multitest.Multi3_HatType" json:"hat_type,omitempty"`
@@ -53,10 +61,12 @@ type Multi3 struct {
 	XXX_sizecache        int32           `json:"-"`
 }
 
-func (m *Multi3) Reset()                    { *m = Multi3{} }
-func (m *Multi3) String() string            { return proto.CompactTextString(m) }
-func (*Multi3) ProtoMessage()               {}
-func (*Multi3) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
+func (m *Multi3) Reset()         { *m = Multi3{} }
+func (m *Multi3) String() string { return proto.CompactTextString(m) }
+func (*Multi3) ProtoMessage()    {}
+func (*Multi3) Descriptor() ([]byte, []int) {
+	return fileDescriptor_multi3_d55a72b4628b7875, []int{0}
+}
 func (m *Multi3) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Multi3.Unmarshal(m, b)
 }
@@ -87,9 +97,9 @@ func init() {
 	proto.RegisterEnum("multitest.Multi3_HatType", Multi3_HatType_name, Multi3_HatType_value)
 }
 
-func init() { proto.RegisterFile("multi/multi3.proto", fileDescriptor2) }
+func init() { proto.RegisterFile("multi/multi3.proto", fileDescriptor_multi3_d55a72b4628b7875) }
 
-var fileDescriptor2 = []byte{
+var fileDescriptor_multi3_d55a72b4628b7875 = []byte{
 	// 170 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2d, 0xcd, 0x29,
 	0xc9, 0xd4, 0x07, 0x93, 0xc6, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, 0x60, 0x5e, 0x49,

+ 80 - 50
protoc-gen-go/testdata/my_test/test.pb.go

@@ -56,7 +56,9 @@ func (x *HatType) UnmarshalJSON(data []byte) error {
 	*x = HatType(value)
 	return nil
 }
-func (HatType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (HatType) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{0}
+}
 
 // This enum represents days of the week.
 type Days int32
@@ -94,7 +96,9 @@ func (x *Days) UnmarshalJSON(data []byte) error {
 	*x = Days(value)
 	return nil
 }
-func (Days) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (Days) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{1}
+}
 
 type Request_Color int32
 
@@ -131,7 +135,9 @@ func (x *Request_Color) UnmarshalJSON(data []byte) error {
 	*x = Request_Color(value)
 	return nil
 }
-func (Request_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
+func (Request_Color) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{0, 0}
+}
 
 type Reply_Entry_Game int32
 
@@ -165,7 +171,9 @@ func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error {
 	*x = Reply_Entry_Game(value)
 	return nil
 }
-func (Reply_Entry_Game) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0, 0} }
+func (Reply_Entry_Game) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{1, 0, 0}
+}
 
 // This is a message that might be sent somewhere.
 type Request struct {
@@ -188,10 +196,12 @@ type Request struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Request) Reset()                    { *m = Request{} }
-func (m *Request) String() string            { return proto.CompactTextString(m) }
-func (*Request) ProtoMessage()               {}
-func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *Request) Reset()         { *m = Request{} }
+func (m *Request) String() string { return proto.CompactTextString(m) }
+func (*Request) ProtoMessage()    {}
+func (*Request) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{0}
+}
 func (m *Request) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Request.Unmarshal(m, b)
 }
@@ -284,10 +294,12 @@ type Request_SomeGroup struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Request_SomeGroup) Reset()                    { *m = Request_SomeGroup{} }
-func (m *Request_SomeGroup) String() string            { return proto.CompactTextString(m) }
-func (*Request_SomeGroup) ProtoMessage()               {}
-func (*Request_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
+func (m *Request_SomeGroup) Reset()         { *m = Request_SomeGroup{} }
+func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) }
+func (*Request_SomeGroup) ProtoMessage()    {}
+func (*Request_SomeGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{0, 0}
+}
 func (m *Request_SomeGroup) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Request_SomeGroup.Unmarshal(m, b)
 }
@@ -322,10 +334,12 @@ type Reply struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *Reply) Reset()                    { *m = Reply{} }
-func (m *Reply) String() string            { return proto.CompactTextString(m) }
-func (*Reply) ProtoMessage()               {}
-func (*Reply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *Reply) Reset()         { *m = Reply{} }
+func (m *Reply) String() string { return proto.CompactTextString(m) }
+func (*Reply) ProtoMessage()    {}
+func (*Reply) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{1}
+}
 
 var extRange_Reply = []proto.ExtensionRange{
 	{100, 536870911},
@@ -375,10 +389,12 @@ type Reply_Entry struct {
 	XXX_sizecache                 int32    `json:"-"`
 }
 
-func (m *Reply_Entry) Reset()                    { *m = Reply_Entry{} }
-func (m *Reply_Entry) String() string            { return proto.CompactTextString(m) }
-func (*Reply_Entry) ProtoMessage()               {}
-func (*Reply_Entry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} }
+func (m *Reply_Entry) Reset()         { *m = Reply_Entry{} }
+func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
+func (*Reply_Entry) ProtoMessage()    {}
+func (*Reply_Entry) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{1, 0}
+}
 func (m *Reply_Entry) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Reply_Entry.Unmarshal(m, b)
 }
@@ -428,10 +444,12 @@ type OtherBase struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *OtherBase) Reset()                    { *m = OtherBase{} }
-func (m *OtherBase) String() string            { return proto.CompactTextString(m) }
-func (*OtherBase) ProtoMessage()               {}
-func (*OtherBase) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
+func (m *OtherBase) Reset()         { *m = OtherBase{} }
+func (m *OtherBase) String() string { return proto.CompactTextString(m) }
+func (*OtherBase) ProtoMessage()    {}
+func (*OtherBase) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{2}
+}
 
 var extRange_OtherBase = []proto.ExtensionRange{
 	{100, 536870911},
@@ -471,10 +489,12 @@ type ReplyExtensions struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *ReplyExtensions) Reset()                    { *m = ReplyExtensions{} }
-func (m *ReplyExtensions) String() string            { return proto.CompactTextString(m) }
-func (*ReplyExtensions) ProtoMessage()               {}
-func (*ReplyExtensions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
+func (m *ReplyExtensions) Reset()         { *m = ReplyExtensions{} }
+func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
+func (*ReplyExtensions) ProtoMessage()    {}
+func (*ReplyExtensions) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{3}
+}
 func (m *ReplyExtensions) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_ReplyExtensions.Unmarshal(m, b)
 }
@@ -527,10 +547,12 @@ type OtherReplyExtensions struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *OtherReplyExtensions) Reset()                    { *m = OtherReplyExtensions{} }
-func (m *OtherReplyExtensions) String() string            { return proto.CompactTextString(m) }
-func (*OtherReplyExtensions) ProtoMessage()               {}
-func (*OtherReplyExtensions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
+func (m *OtherReplyExtensions) Reset()         { *m = OtherReplyExtensions{} }
+func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) }
+func (*OtherReplyExtensions) ProtoMessage()    {}
+func (*OtherReplyExtensions) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{4}
+}
 func (m *OtherReplyExtensions) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_OtherReplyExtensions.Unmarshal(m, b)
 }
@@ -563,10 +585,12 @@ type OldReply struct {
 	XXX_sizecache                int32  `json:"-"`
 }
 
-func (m *OldReply) Reset()                    { *m = OldReply{} }
-func (m *OldReply) String() string            { return proto.CompactTextString(m) }
-func (*OldReply) ProtoMessage()               {}
-func (*OldReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+func (m *OldReply) Reset()         { *m = OldReply{} }
+func (m *OldReply) String() string { return proto.CompactTextString(m) }
+func (*OldReply) ProtoMessage()    {}
+func (*OldReply) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{5}
+}
 
 func (m *OldReply) MarshalJSON() ([]byte, error) {
 	return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
@@ -621,10 +645,12 @@ type Communique struct {
 	XXX_sizecache        int32              `json:"-"`
 }
 
-func (m *Communique) Reset()                    { *m = Communique{} }
-func (m *Communique) String() string            { return proto.CompactTextString(m) }
-func (*Communique) ProtoMessage()               {}
-func (*Communique) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
+func (m *Communique) Reset()         { *m = Communique{} }
+func (m *Communique) String() string { return proto.CompactTextString(m) }
+func (*Communique) ProtoMessage()    {}
+func (*Communique) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{6}
+}
 func (m *Communique) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Communique.Unmarshal(m, b)
 }
@@ -972,10 +998,12 @@ type Communique_SomeGroup struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Communique_SomeGroup) Reset()                    { *m = Communique_SomeGroup{} }
-func (m *Communique_SomeGroup) String() string            { return proto.CompactTextString(m) }
-func (*Communique_SomeGroup) ProtoMessage()               {}
-func (*Communique_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 0} }
+func (m *Communique_SomeGroup) Reset()         { *m = Communique_SomeGroup{} }
+func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) }
+func (*Communique_SomeGroup) ProtoMessage()    {}
+func (*Communique_SomeGroup) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{6, 0}
+}
 func (m *Communique_SomeGroup) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Communique_SomeGroup.Unmarshal(m, b)
 }
@@ -1007,10 +1035,12 @@ type Communique_Delta struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Communique_Delta) Reset()                    { *m = Communique_Delta{} }
-func (m *Communique_Delta) String() string            { return proto.CompactTextString(m) }
-func (*Communique_Delta) ProtoMessage()               {}
-func (*Communique_Delta) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6, 1} }
+func (m *Communique_Delta) Reset()         { *m = Communique_Delta{} }
+func (m *Communique_Delta) String() string { return proto.CompactTextString(m) }
+func (*Communique_Delta) ProtoMessage()    {}
+func (*Communique_Delta) Descriptor() ([]byte, []int) {
+	return fileDescriptor_test_4c0531be33cf90ba, []int{6, 1}
+}
 func (m *Communique_Delta) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Communique_Delta.Unmarshal(m, b)
 }
@@ -1072,9 +1102,9 @@ func init() {
 	proto.RegisterExtension(E_Donut)
 }
 
-func init() { proto.RegisterFile("my_test/test.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("my_test/test.proto", fileDescriptor_test_4c0531be33cf90ba) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_test_4c0531be33cf90ba = []byte{
 	// 1035 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdb, 0x6e, 0xdb, 0x46,
 	0x13, 0xd6, 0x92, 0xa2, 0x0e, 0x23, 0xc5, 0xe6, 0xbf, 0x30, 0x6c, 0x42, 0x3f, 0x12, 0xb3, 0x6a,

+ 17 - 11
protoc-gen-go/testdata/proto3/proto3.pb.go

@@ -43,7 +43,9 @@ var Request_Flavour_value = map[string]int32{
 func (x Request_Flavour) String() string {
 	return proto.EnumName(Request_Flavour_name, int32(x))
 }
-func (Request_Flavour) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
+func (Request_Flavour) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_proto3_a752e09251f17e01, []int{0, 0}
+}
 
 type Request struct {
 	Name                 string          `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
@@ -56,10 +58,12 @@ type Request struct {
 	XXX_sizecache        int32           `json:"-"`
 }
 
-func (m *Request) Reset()                    { *m = Request{} }
-func (m *Request) String() string            { return proto.CompactTextString(m) }
-func (*Request) ProtoMessage()               {}
-func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
+func (m *Request) Reset()         { *m = Request{} }
+func (m *Request) String() string { return proto.CompactTextString(m) }
+func (*Request) ProtoMessage()    {}
+func (*Request) Descriptor() ([]byte, []int) {
+	return fileDescriptor_proto3_a752e09251f17e01, []int{0}
+}
 func (m *Request) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Request.Unmarshal(m, b)
 }
@@ -121,10 +125,12 @@ type Book struct {
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *Book) Reset()                    { *m = Book{} }
-func (m *Book) String() string            { return proto.CompactTextString(m) }
-func (*Book) ProtoMessage()               {}
-func (*Book) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
+func (m *Book) Reset()         { *m = Book{} }
+func (m *Book) String() string { return proto.CompactTextString(m) }
+func (*Book) ProtoMessage()    {}
+func (*Book) Descriptor() ([]byte, []int) {
+	return fileDescriptor_proto3_a752e09251f17e01, []int{1}
+}
 func (m *Book) XXX_Unmarshal(b []byte) error {
 	return xxx_messageInfo_Book.Unmarshal(m, b)
 }
@@ -163,9 +169,9 @@ func init() {
 	proto.RegisterEnum("proto3.Request_Flavour", Request_Flavour_name, Request_Flavour_value)
 }
 
-func init() { proto.RegisterFile("proto3/proto3.proto", fileDescriptor0) }
+func init() { proto.RegisterFile("proto3/proto3.proto", fileDescriptor_proto3_a752e09251f17e01) }
 
-var fileDescriptor0 = []byte{
+var fileDescriptor_proto3_a752e09251f17e01 = []byte{
 	// 306 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0xcf, 0x4e, 0xf2, 0x40,
 	0x14, 0xc5, 0x99, 0xfe, 0xf9, 0x80, 0xfb, 0xa1, 0x19, 0xaf, 0x26, 0x8e, 0x1b, 0x33, 0x61, 0xd5,