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>
This commit is contained in:
Damien Neil 2018-09-05 14:48:58 -07:00
parent d901677135
commit ef18063941

View File

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