mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 11:58:21 +00:00
internal/legacy: use proto.Unmarshal from v2
Change-Id: Ic1e757a11f233657d6c3a840719ebef34d81e4f5 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167716 Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
parent
f83d5bb6f0
commit
69996ba400
@ -56,9 +56,8 @@ func loadFileDesc(b []byte) *descriptorpb.FileDescriptorProto {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// TODO: What about extensions?
|
||||
// The protoV1 API does not eagerly unmarshal extensions.
|
||||
if err := proto.Unmarshal(b, m); err != nil {
|
||||
err = proto.UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fileDescCache.Store(&b[0], m)
|
||||
|
Loading…
Reference in New Issue
Block a user