cmd/protoc-gen-go: remove XXX_OneofWrappers

Change-Id: I31a311c9ea24e959d5d641c66c4ee77f0c98a2ed
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186917
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2019-07-19 01:18:41 -07:00
parent 3efb138050
commit d57568e763

View File

@ -40,10 +40,6 @@ const (
// to the given enum or message descriptor. // to the given enum or message descriptor.
generateRawDescMethods = true generateRawDescMethods = true
// generateOneofWrapperMethods specifies whether to generate
// XXX_OneofWrappers methods on messages with oneofs.
generateOneofWrapperMethods = false
// generateExtensionRangeMethods specifies whether to generate the // generateExtensionRangeMethods specifies whether to generate the
// ExtensionRangeArray method for messages that support extensions. // ExtensionRangeArray method for messages that support extensions.
generateExtensionRangeMethods = true generateExtensionRangeMethods = true
@ -615,17 +611,6 @@ func genMessageBaseMethods(gen *protogen.Plugin, g *protogen.GeneratedFile, f *f
g.P() g.P()
} }
} }
// XXX_OneofWrappers method.
if generateOneofWrapperMethods && len(message.Oneofs) > 0 {
idx := f.allMessagesByPtr[message]
typesVar := messageTypesVarName(f)
g.P("// XXX_OneofWrappers is for the internal use of the proto package.")
g.P("func (*", message.GoIdent.GoName, ") XXX_OneofWrappers() []interface{} {")
g.P("return ", typesVar, "[", idx, "].OneofWrappers")
g.P("}")
g.P()
}
} }
func genMessageGetterMethods(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) { func genMessageGetterMethods(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) {