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/test_public.pb.go b/internal/testprotos/test/test_public.pb.go
index 832e324..be20ac9 100644
--- a/internal/testprotos/test/test_public.pb.go
+++ b/internal/testprotos/test/test_public.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"
@@ -76,21 +75,32 @@
var file_test_test_public_proto_goTypes = []interface{}{
(*PublicImportMessage)(nil), // 0: goproto.proto.test.PublicImportMessage
}
-var file_test_test_public_proto_depIdxs = []int32{}
+var file_test_test_public_proto_depIdxs = []int32{
+ 0, // starting offset of method output_type sub-list
+ 0, // starting offset of method input_type sub-list
+ 0, // 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_test_public_proto_init() }
func file_test_test_public_proto_init() {
if File_test_test_public_proto != nil {
return
}
- File_test_test_public_proto = protoimpl.FileBuilder{
- RawDescriptor: file_test_test_public_proto_rawDesc,
- GoTypes: file_test_test_public_proto_goTypes,
- DependencyIndexes: file_test_test_public_proto_depIdxs,
- MessageOutputTypes: file_test_test_public_proto_msgTypes,
- FilesRegistry: protoregistry.GlobalFiles,
- TypesRegistry: protoregistry.GlobalTypes,
- }.Init()
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ RawDescriptor: file_test_test_public_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 1,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_test_test_public_proto_goTypes,
+ DependencyIndexes: file_test_test_public_proto_depIdxs,
+ MessageInfos: file_test_test_public_proto_msgTypes,
+ }.Build()
+ File_test_test_public_proto = out.File
file_test_test_public_proto_rawDesc = nil
file_test_test_public_proto_goTypes = nil
file_test_test_public_proto_depIdxs = nil