mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-27 15:26:51 +00:00
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>
This commit is contained in:
parent
411f33952f
commit
b6dbf23033
@ -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, " {")
|
||||
|
@ -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},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user