protobuf-go/internal/filedesc
Joe Tsai 50f860a45a internal/filedesc: fix dependency on legacy generated enums
Suppose you have a generated message with an enum field that
has a default value, where the enum is declared in another proto file
that does not register its descriptors.
In such a situation, the enum dependency cannot be resolved and will
be left as a placeholder.

When unmarshalDefault is called, it will attempt to parse the enum
name stored as the default value, but panic since the placeholder enum
has no enum values known to it.

Instead of panicking, use a placeholder enum value that preserves the
name of default enum value and just use the enum number of 0.
This is not ideal, but is a better alternative than panicking.

Change-Id: I5ff6c351adbdd6fe7b41f2d4f215be4aa09e751f
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/192500
Reviewed-by: Damien Neil <dneil@google.com>
2019-09-03 20:42:35 +00:00
..
build_test.go all: implement proto1 weak fields 2019-07-15 18:44:12 +00:00
build.go internal/filetype, internal/filedesc: avoid gccgo bug 2019-08-27 19:57:09 +00:00
desc_init.go internal/filedesc, internal/filetype: rename {Desc,Type}Builder as Builder 2019-08-05 23:43:37 +00:00
desc_lazy.go internal/filedesc, internal/filetype: rename {Desc,Type}Builder as Builder 2019-08-05 23:43:37 +00:00
desc_list_gen.go
desc_list.go reflect/protoreflect: add FileDescriptor.SourceLocations 2019-07-13 00:15:59 +00:00
desc_test.go internal/filedesc, internal/filetype: rename {Desc,Type}Builder as Builder 2019-08-05 23:43:37 +00:00
desc.go internal/filedesc: fix dependency on legacy generated enums 2019-09-03 20:42:35 +00:00
placeholder.go reflect/protoreflect: add FileDescriptor.SourceLocations 2019-07-13 00:15:59 +00:00