Explorar o código

cmd/protoc-gen-go: remove generation of {Unmarshal,Marshal}JSON for MessageSets

PR#741 in the v1 repository deprecated this behavior.

Change-Id: Idffa3884d43f9cc5528ce8d9f303676e0e501b67
Reviewed-on: https://go-review.googlesource.com/c/151400
Reviewed-by: Damien Neil <dneil@google.com>
Joe Tsai %!s(int64=7) %!d(string=hai) anos
pai
achega
b6dbf23033

+ 0 - 10
cmd/protoc-gen-go/internal_gengo/main.go

@@ -417,16 +417,6 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, me
 
 	// ExtensionRangeArray
 	if extranges := message.Desc.ExtensionRanges(); extranges.Len() > 0 {
-		if message.Desc.Options().(*descpb.MessageOptions).GetMessageSetWireFormat() {
-			g.P("func (m *", message.GoIdent, ") MarshalJSON() ([]byte, error) {")
-			g.P("return ", protoPackage.Ident("MarshalMessageSetJSON"), "(&m.XXX_InternalExtensions)")
-			g.P("}")
-			g.P("func (m *", message.GoIdent, ") UnmarshalJSON(buf []byte) error {")
-			g.P("return ", protoPackage.Ident("UnmarshalMessageSetJSON"), "(buf, &m.XXX_InternalExtensions)")
-			g.P("}")
-			g.P()
-		}
-
 		protoExtRange := protoPackage.Ident("ExtensionRange")
 		extRangeVar := "extRange_" + message.GoIdent.GoName
 		g.P("var ", extRangeVar, " = []", protoExtRange, " {")

+ 0 - 7
cmd/protoc-gen-go/testdata/extensions/base/base.pb.go

@@ -83,13 +83,6 @@ func (*MessageSetWireFormatMessage) Descriptor() ([]byte, []int) {
 	return fileDescriptor_aebb28f8d5a04466, []int{1}
 }
 
-func (m *MessageSetWireFormatMessage) MarshalJSON() ([]byte, error) {
-	return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions)
-}
-func (m *MessageSetWireFormatMessage) UnmarshalJSON(buf []byte) error {
-	return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)
-}
-
 var extRange_MessageSetWireFormatMessage = []proto.ExtensionRange{
 	{Start: 100, End: 2147483646},
 }