Permalink
Browse files

dev: protoc-gen-go: handle package import names per-file - merge 9d49…

…62b4dc40a899c435fe1aaec48e683b4300ef from golang/protobuf
  • Loading branch information...
awalterschulze committed Apr 8, 2018
1 parent 08f8895 commit aa7e6f4b58a59e25ca6d89e2a971fe199df9aa8a
Showing with 20,020 additions and 19,975 deletions.
  1. +61 −66 _conformance/conformance_proto/conformance.pb.go
  2. +72 −72 gogoproto/gogo.pb.go
  3. +39 −43 jsonpb/jsonpb_test_proto/test_objects.pb.go
  4. +3 −2 plugin/embedcheck/embedcheck.go
  5. +1 −1 plugin/gostring/gostring.go
  6. +1 −1 plugin/populate/populate.go
  7. +1 −1 plugin/union/union.go
  8. +5 −5 proto/proto3_proto/proto3.pb.go
  9. +4 −3 protoc-gen-gogo/descriptor/descriptor_gostring.gen.go
  10. +190 −217 protoc-gen-gogo/generator/generator.go
  11. +13 −13 protoc-gen-gogo/generator/helper.go
  12. +1 −1 protoc-gen-gogo/generator/name_test.go
  13. +3 −3 protoc-gen-gogo/plugin/plugin.pb.go
  14. +2 −2 protoc-gen-gogo/testdata/deprecated/deprecated.pb.go
  15. +2 −2 protoc-gen-gogo/testdata/grpc/grpc.pb.go
  16. +2 −2 protoc-gen-gogo/testdata/imports/fmt/m.pb.go
  17. +6 −6 protoc-gen-gogo/testdata/imports/test_import_a1m1.pb.go
  18. +6 −6 protoc-gen-gogo/testdata/imports/test_import_a1m2.pb.go
  19. +19 −22 protoc-gen-gogo/testdata/imports/test_import_all.pb.go
  20. +13 −13 protoc-gen-gogo/testdata/imports/test_import_public.pb.go
  21. +35 −34 test/casttype/combos/both/casttype.pb.go
  22. +69 −68 test/casttype/combos/both/casttypepb_test.go
  23. +31 −30 test/casttype/combos/marshaler/casttype.pb.go
  24. +69 −68 test/casttype/combos/marshaler/casttypepb_test.go
  25. +26 −25 test/casttype/combos/neither/casttype.pb.go
  26. +65 −64 test/casttype/combos/neither/casttypepb_test.go
  27. +31 −30 test/casttype/combos/unmarshaler/casttype.pb.go
  28. +65 −64 test/casttype/combos/unmarshaler/casttypepb_test.go
  29. +22 −21 test/castvalue/castvalue.pb.go
  30. +65 −64 test/castvalue/castvaluepb_test.go
  31. +22 −21 test/castvalue/combos/both/castvalue.pb.go
  32. +69 −68 test/castvalue/combos/both/castvaluepb_test.go
  33. +22 −21 test/castvalue/combos/marshaler/castvalue.pb.go
  34. +69 −68 test/castvalue/combos/marshaler/castvaluepb_test.go
  35. +22 −21 test/castvalue/combos/unmarshaler/castvalue.pb.go
  36. +65 −64 test/castvalue/combos/unmarshaler/castvaluepb_test.go
  37. +482 −481 test/combos/both/thetest.pb.go
  38. +2,386 −2,385 test/combos/both/thetestpb_test.go
  39. +368 −367 test/combos/marshaler/thetest.pb.go
  40. +2,386 −2,385 test/combos/marshaler/thetestpb_test.go
  41. +403 −402 test/combos/unmarshaler/thetest.pb.go
  42. +2,250 −2,249 test/combos/unmarshaler/thetestpb_test.go
  43. +36 −35 test/data/datapb_test.go
  44. +31 −30 test/enumdecl/enumdeclpb_test.go
  45. +31 −30 test/enumdecl_all/enumdeclallpb_test.go
  46. +1 −1 test/enumprefix/enumprefix.pb.go
  47. +67 −66 test/enumstringer/enumstringerpb_test.go
  48. +16 −15 test/example/example.pb.go
  49. +224 −223 test/example/examplepb_test.go
  50. +13 −12 test/filedotname/file.dot.pb.go
  51. +35 −34 test/filedotname/file.dotpb_test.go
  52. +35 −35 test/fuzztests/fuzz.pb.go
  53. +13 −12 test/group/group.pb.go
  54. +81 −80 test/group/grouppb_test.go
  55. +22 −21 test/importcustom-issue389/imported/apb_test.go
  56. +22 −21 test/importcustom-issue389/importing/cpb_test.go
  57. +3 −3 test/importduplicate/importduplicate.pb.go
  58. +21 −20 test/importduplicate/importduplicatepb_test.go
  59. +8 −8 test/importduplicate/proto/proto.pb.go
  60. +21 −20 test/importduplicate/proto/protopb_test.go
  61. +20 −19 test/importduplicate/sortkeys/sortablepb_test.go
  62. +22 −21 test/indeximport-issue72/index/indexpb_test.go
  63. +1 −1 test/indeximport-issue72/indeximport.pb.go
  64. +23 −22 test/indeximport-issue72/indeximportpb_test.go
  65. +36 −35 test/int64support/objectpb_test.go
  66. +6 −6 test/issue260/issue260.pb.go
  67. +87 −86 test/issue260/issue260pb_test.go
  68. +9 −9 test/issue261/issue261.pb.go
  69. +6 −6 test/issue262/timefail.pb.go
  70. +1 −1 test/issue312/events/events.pb.go
  71. +21 −20 test/issue312/events/eventspb_test.go
  72. +26 −25 test/issue322/issue322pb_test.go
  73. +28 −27 test/issue330/issue330pb_test.go
  74. +5 −5 test/issue42order/issue42.pb.go
  75. +10 −9 test/issue8/proto.pb.go
  76. +18 −17 test/issue8/protopb_test.go
  77. +15 −14 test/mapdefaults/combos/both/map.pb.go
  78. +80 −79 test/mapdefaults/combos/both/mappb_test.go
  79. +15 −14 test/mapdefaults/combos/marshaler/map.pb.go
  80. +80 −79 test/mapdefaults/combos/marshaler/mappb_test.go
  81. +15 −14 test/mapdefaults/combos/neither/map.pb.go
  82. +74 −73 test/mapdefaults/combos/neither/mappb_test.go
  83. +15 −14 test/mapdefaults/combos/unmarshaler/map.pb.go
  84. +74 −73 test/mapdefaults/combos/unmarshaler/mappb_test.go
  85. +162 −161 test/mapsproto2/combos/both/mapsproto2.pb.go
  86. +133 −132 test/mapsproto2/combos/both/mapsproto2pb_test.go
  87. +141 −140 test/mapsproto2/combos/marshaler/mapsproto2.pb.go
  88. +133 −132 test/mapsproto2/combos/marshaler/mapsproto2pb_test.go
  89. +102 −101 test/mapsproto2/combos/neither/mapsproto2.pb.go
  90. +125 −124 test/mapsproto2/combos/neither/mapsproto2pb_test.go
  91. +124 −123 test/mapsproto2/combos/unmarshaler/mapsproto2.pb.go
  92. +125 −124 test/mapsproto2/combos/unmarshaler/mapsproto2pb_test.go
  93. +8 −8 test/moredefaults/md.pb.go
  94. +29 −28 test/moredefaults/mdpb_test.go
  95. +3 −3 test/nopackage/nopackage.pb.go
  96. +30 −29 test/oneof/combos/both/one.pb.go
  97. +105 −104 test/oneof/combos/both/onepb_test.go
  98. +22 −21 test/oneof/combos/marshaler/one.pb.go
  99. +105 −104 test/oneof/combos/marshaler/onepb_test.go
  100. +13 −12 test/oneof/combos/neither/one.pb.go
  101. +97 −96 test/oneof/combos/neither/onepb_test.go
  102. +22 −21 test/oneof/combos/unmarshaler/one.pb.go
  103. +97 −96 test/oneof/combos/unmarshaler/onepb_test.go
  104. +24 −23 test/oneof3/combos/both/one.pb.go
  105. +55 −54 test/oneof3/combos/both/onepb_test.go
  106. +18 −17 test/oneof3/combos/marshaler/one.pb.go
  107. +55 −54 test/oneof3/combos/marshaler/onepb_test.go
  108. +11 −10 test/oneof3/combos/neither/one.pb.go
  109. +51 −50 test/oneof3/combos/neither/onepb_test.go
  110. +18 −17 test/oneof3/combos/unmarshaler/one.pb.go
  111. +51 −50 test/oneof3/combos/unmarshaler/onepb_test.go
  112. +24 −24 test/oneofembed/oneofembed.pb.go
  113. +31 −30 test/oneofembed/oneofembedpb_test.go
  114. +49 −49 test/packed/packed.pb.go
  115. +3 −3 test/proto3extension/proto3ext.pb.go
  116. +22 −21 test/protosize/protosizepb_test.go
  117. +73 −72 test/required/requiredexample.pb.go
  118. +22 −21 test/sizeunderscore/sizeunderscorepb_test.go
  119. +33 −36 test/stdtypes/stdtypes.pb.go
  120. +117 −117 test/stdtypes/stdtypespb_test.go
  121. +212 −211 test/theproto3/combos/both/theproto3.pb.go
  122. +325 −324 test/theproto3/combos/both/theproto3pb_test.go
  123. +185 −184 test/theproto3/combos/marshaler/theproto3.pb.go
  124. +325 −324 test/theproto3/combos/marshaler/theproto3pb_test.go
  125. +144 −143 test/theproto3/combos/neither/theproto3.pb.go
  126. +305 −304 test/theproto3/combos/neither/theproto3pb_test.go
  127. +172 −171 test/theproto3/combos/unmarshaler/theproto3.pb.go
  128. +305 −304 test/theproto3/combos/unmarshaler/theproto3pb_test.go
  129. +288 −287 test/thetest.pb.go
  130. +2,250 −2,249 test/thetestpb_test.go
  131. +87 −86 test/typedecl/typedeclpb_test.go
  132. +87 −86 test/typedecl_all/typedeclallpb_test.go
  133. +209 −213 test/types/combos/both/types.pb.go
  134. +264 −265 test/types/combos/both/typespb_test.go
  135. +164 −168 test/types/combos/marshaler/types.pb.go
  136. +264 −265 test/types/combos/marshaler/typespb_test.go
  137. +132 −136 test/types/combos/neither/types.pb.go
  138. +246 −247 test/types/combos/neither/typespb_test.go
  139. +177 −181 test/types/combos/unmarshaler/types.pb.go
  140. +246 −247 test/types/combos/unmarshaler/typespb_test.go
  141. +10 −9 test/unmarshalmerge/unmarshalmerge.pb.go
  142. +101 −100 test/unmarshalmerge/unmarshalmergepb_test.go
  143. +39 −38 test/unrecognized/unrecognized.pb.go
  144. +268 −267 test/unrecognized/unrecognizedpb_test.go
  145. +18 −17 test/unrecognizedgroup/unrecognizedgroup.pb.go
  146. +112 −111 test/unrecognizedgroup/unrecognizedgrouppb_test.go
  147. +6 −6 types/struct.pb.go
  148. +5 −5 types/wrappers.pb.go
  149. +4 −2 vanity/test/fast/vanity.pb.go
  150. +2 −1 vanity/test/faster/vanity.pb.go
  151. +2 −1 vanity/test/slick/vanity.pb.go

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -47,9 +47,10 @@ package embedcheck
import (
"fmt"
"os"
"github.com/gogo/protobuf/gogoproto"
"github.com/gogo/protobuf/protoc-gen-gogo/generator"
"os"
)
type plugin struct {
@@ -163,7 +164,7 @@ func (p *plugin) checkOverwrite(message *generator.Descriptor, enablers map[stri
desc := p.ObjectNamed(field.GetTypeName())
msg := desc.(*generator.Descriptor)
for errStr, enabled := range enablers {
if enabled(msg.File(), msg.DescriptorProto) {
if enabled(msg.File().FileDescriptorProto, msg.DescriptorProto) {
fmt.Fprintf(os.Stderr, "WARNING: found non-%v %v with embedded %v %v\n", names, ccTypeName, errStr, fieldname)
}
}
@@ -157,7 +157,7 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
continue
}
p.atleastOne = true
packageName := file.PackageName()
packageName := file.GoPackageName()
ccTypeName := generator.CamelCaseSlice(message.TypeName())
p.P(`func (this *`, ccTypeName, `) GoString() string {`)
@@ -534,7 +534,7 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
p.P(`func NewPopulated`, ccTypeName, `(r randy`, p.localName, `, easy bool) *`, ccTypeName, ` {`)
p.In()
p.P(`this := &`, ccTypeName, `{}`)
if gogoproto.IsUnion(message.File(), message.DescriptorProto) && len(message.Field) > 0 {
if gogoproto.IsUnion(message.File().FileDescriptorProto, message.DescriptorProto) && len(message.Field) > 0 {
p.P(`fieldNum := r.Intn(`, fmt.Sprintf("%d", ranTotal), `)`)
p.P(`switch fieldNum {`)
k := 0
View
@@ -184,7 +184,7 @@ func (p *union) Generate(file *generator.FileDescriptor) {
goTyp, _ := p.GoType(message, field)
obj := p.ObjectNamed(field.GetTypeName()).(*generator.Descriptor)
if gogoproto.IsUnion(obj.File(), obj.DescriptorProto) {
if gogoproto.IsUnion(obj.File().FileDescriptorProto, obj.DescriptorProto) {
p.P(`this.`, fieldname, ` = new(`, generator.GoTypeToName(goTyp), `)`)
p.P(`if set := this.`, fieldname, `.SetValue(value); set {`)
p.In()

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit aa7e6f4

Please sign in to comment.