Преглед на файлове

reflect/prototype: default proto file syntax is "proto2"

protoc leaves FileDescriptorProto.Syntax unset when the syntax is
"proto2".

Change-Id: Id1370145fc9c5c67344f5a998d118fd0f9f65f24
Reviewed-on: https://go-review.googlesource.com/133636
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Damien Neil преди 7 години
родител
ревизия
ef18063941
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      reflect/prototype/protofile_desc.go

+ 1 - 1
reflect/prototype/protofile_desc.go

@@ -55,7 +55,7 @@ import (
 func NewFileFromDescriptorProto(fd *descriptorV1.FileDescriptorProto, r *protoregistry.Files) (protoreflect.FileDescriptor, error) {
 	var f File
 	switch fd.GetSyntax() {
-	case "proto2":
+	case "", "proto2":
 		f.Syntax = protoreflect.Proto2
 	case "proto3":
 		f.Syntax = protoreflect.Proto3