internal/filedesc, internal/filetype: initial commit
The internal/fileinit package is split apart into two packages:
* internal/filedesc constructs descriptors from the raw proto.
It is very similar to the previous internal/fileinit package.
* internal/filetype wraps descriptors with Go type information
Overview:
* The internal/fileinit package will be deleted in a future CL.
It is kept around since the v1 repo currently depends on it.
* The internal/prototype package is deleted. All former usages of it
are now using internal/filedesc instead. Most significantly,
the reflect/protodesc package was almost entirely re-written.
* The internal/impl package drops support for messages that do not
have a Descriptor method (pre-2016). This removes a significant amount
of technical debt.
filedesc.Builder to parse raw descriptors.
* The internal/encoding/defval package now handles enum values by name.
Change-Id: I3957bcc8588a70470fd6c7de1122216b80615ab7
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/182360
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/testprotos/test/ext.pb.go b/internal/testprotos/test/ext.pb.go
index 58cb656..7a3363c 100644
--- a/internal/testprotos/test/ext.pb.go
+++ b/internal/testprotos/test/ext.pb.go
@@ -5,7 +5,6 @@
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoregistry "google.golang.org/protobuf/reflect/protoregistry"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
sync "sync"
@@ -67,6 +66,11 @@
}
var file_test_ext_proto_depIdxs = []int32{
0, // goproto.proto.test.foreign_int32_extension:extendee -> goproto.proto.test.TestAllExtensions
+ 1, // starting offset of method output_type sub-list
+ 1, // starting offset of method input_type sub-list
+ 1, // starting offset of extension type_name sub-list
+ 0, // starting offset of extension extendee sub-list
+ 0, // starting offset of field type_name sub-list
}
func init() { file_test_ext_proto_init() }
@@ -75,16 +79,19 @@
return
}
file_test_test_proto_init()
- extensionTypes := make([]protoreflect.ExtensionType, 1)
- File_test_ext_proto = protoimpl.FileBuilder{
- RawDescriptor: file_test_ext_proto_rawDesc,
- GoTypes: file_test_ext_proto_goTypes,
- DependencyIndexes: file_test_ext_proto_depIdxs,
- LegacyExtensions: file_test_ext_proto_extDescs,
- ExtensionOutputTypes: extensionTypes,
- FilesRegistry: protoregistry.GlobalFiles,
- TypesRegistry: protoregistry.GlobalTypes,
- }.Init()
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ RawDescriptor: file_test_ext_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 0,
+ NumExtensions: 1,
+ NumServices: 0,
+ },
+ GoTypes: file_test_ext_proto_goTypes,
+ DependencyIndexes: file_test_ext_proto_depIdxs,
+ LegacyExtensions: file_test_ext_proto_extDescs,
+ }.Build()
+ File_test_ext_proto = out.File
file_test_ext_proto_rawDesc = nil
file_test_ext_proto_goTypes = nil
file_test_ext_proto_depIdxs = nil