Explorar o código

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>
Joe Tsai %!s(int64=7) %!d(string=hai) anos
pai
achega
69996ba400
Modificáronse 1 ficheiros con 2 adicións e 3 borrados
  1. 2 3
      internal/legacy/file.go

+ 2 - 3
internal/legacy/file.go

@@ -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)