Skip to content

Commit 8cc9e46

Browse files
committed
Upstream internal Google protobuf changes
Major changes: * New table-driven optimization for marshal, unmarshal, and merge * Unknown field preservation for Proto3 * Generated source-file annotation for Kythe * Various bug fixes
1 parent 1643683 commit 8cc9e46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+15457
-4069
lines changed

_conformance/conformance.go

+14-10
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,18 @@ var jsonMarshaler = jsonpb.Marshaler{
9595

9696
func handle(req *pb.ConformanceRequest) *pb.ConformanceResponse {
9797
var err error
98-
var msg pb.TestAllTypes
98+
var msg pb.TestAllTypesProto3
99+
var msg1 pb.TestAllTypesProto2
100+
var isProto3 bool = bool(req.MessageType == "protobuf_test_messages.proto3.TestAllTypesProto3")
99101
switch p := req.Payload.(type) {
100102
case *pb.ConformanceRequest_ProtobufPayload:
101-
err = proto.Unmarshal(p.ProtobufPayload, &msg)
103+
if isProto3 {
104+
err = proto.Unmarshal(p.ProtobufPayload, &msg)
105+
} else {
106+
err = proto.Unmarshal(p.ProtobufPayload, &msg1)
107+
}
102108
case *pb.ConformanceRequest_JsonPayload:
103109
err = jsonpb.UnmarshalString(p.JsonPayload, &msg)
104-
if err != nil && err.Error() == "unmarshaling Any not supported yet" {
105-
return &pb.ConformanceResponse{
106-
Result: &pb.ConformanceResponse_Skipped{
107-
Skipped: err.Error(),
108-
},
109-
}
110-
}
111110
default:
112111
return &pb.ConformanceResponse{
113112
Result: &pb.ConformanceResponse_RuntimeError{
@@ -124,7 +123,12 @@ func handle(req *pb.ConformanceRequest) *pb.ConformanceResponse {
124123
}
125124
switch req.RequestedOutputFormat {
126125
case pb.WireFormat_PROTOBUF:
127-
p, err := proto.Marshal(&msg)
126+
var p []byte
127+
if isProto3 {
128+
p, err = proto.Marshal(&msg)
129+
} else {
130+
p, err = proto.Marshal(&msg1)
131+
}
128132
if err != nil {
129133
return &pb.ConformanceResponse{
130134
Result: &pb.ConformanceResponse_SerializeError{

_conformance/conformance_proto/conformance.pb.go

+307-189
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

descriptor/descriptor_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
"github.com/golang/protobuf/descriptor"
8-
tpb "github.com/golang/protobuf/proto/testdata"
8+
tpb "github.com/golang/protobuf/proto/test_proto"
99
protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
1010
)
1111

jsonpb/jsonpb_test_proto/more_test_objects.pb.go

+125-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)