From 0748a2ad4a5c78b1db6c8090db01e255bcc91365 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 18 Apr 2024 12:14:19 +0200 Subject: [PATCH] feat(cosmos_proto): add annotation to denote version (#133) --- buf.work.yaml | 4 + cosmos.pb.go | 201 ++++--- proto/cosmos_proto/cosmos.proto | 17 +- testpb/1.proto | 2 +- testpb/1.pulsar.go | 199 +++---- testpb/2.proto | 1 + testpb/2.pulsar.go | 72 +-- testpb/3.proto | 23 + testpb/3.pulsar.go | 957 ++++++++++++++++++++++++++++++++ testpb/added_in_test.go | 38 ++ testpb/buf.gen.yaml | 7 + testpb/buf.lock | 8 + testpb/buf.yaml | 3 + 13 files changed, 1332 insertions(+), 200 deletions(-) create mode 100644 buf.work.yaml create mode 100644 testpb/3.proto create mode 100644 testpb/3.pulsar.go create mode 100644 testpb/added_in_test.go create mode 100644 testpb/buf.gen.yaml create mode 100644 testpb/buf.lock create mode 100644 testpb/buf.yaml diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 0000000..0c8d75f --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,4 @@ +version: v1 +directories: + - testpb + - proto diff --git a/cosmos.pb.go b/cosmos.pb.go index e7c2630..ce0bfff 100644 --- a/cosmos.pb.go +++ b/cosmos.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc-gen-go v1.33.0 +// protoc (unknown) // source: cosmos_proto/cosmos.proto package cosmos_proto @@ -215,6 +215,14 @@ func (x *ScalarDescriptor) GetFieldType() []ScalarType { } var file_cosmos_proto_cosmos_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MethodOptions)(nil), + ExtensionType: (*string)(nil), + Field: 93001, + Name: "cosmos_proto.method_added_in", + Tag: "bytes,93001,opt,name=method_added_in", + Filename: "cosmos_proto/cosmos.proto", + }, { ExtendedType: (*descriptorpb.MessageOptions)(nil), ExtensionType: ([]string)(nil), @@ -223,6 +231,14 @@ var file_cosmos_proto_cosmos_proto_extTypes = []protoimpl.ExtensionInfo{ Tag: "bytes,93001,rep,name=implements_interface", Filename: "cosmos_proto/cosmos.proto", }, + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*string)(nil), + Field: 93002, + Name: "cosmos_proto.message_added_in", + Tag: "bytes,93002,opt,name=message_added_in", + Filename: "cosmos_proto/cosmos.proto", + }, { ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*string)(nil), @@ -239,6 +255,14 @@ var file_cosmos_proto_cosmos_proto_extTypes = []protoimpl.ExtensionInfo{ Tag: "bytes,93002,opt,name=scalar", Filename: "cosmos_proto/cosmos.proto", }, + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 93003, + Name: "cosmos_proto.field_added_in", + Tag: "bytes,93003,opt,name=field_added_in", + Filename: "cosmos_proto/cosmos.proto", + }, { ExtendedType: (*descriptorpb.FileOptions)(nil), ExtensionType: ([]*InterfaceDescriptor)(nil), @@ -255,8 +279,24 @@ var file_cosmos_proto_cosmos_proto_extTypes = []protoimpl.ExtensionInfo{ Tag: "bytes,793022,rep,name=declare_scalar", Filename: "cosmos_proto/cosmos.proto", }, + { + ExtendedType: (*descriptorpb.FileOptions)(nil), + ExtensionType: (*string)(nil), + Field: 793023, + Name: "cosmos_proto.file_added_in", + Tag: "bytes,793023,opt,name=file_added_in", + Filename: "cosmos_proto/cosmos.proto", + }, } +// Extension fields to descriptorpb.MethodOptions. +var ( + // method_added_in is used to indicate from which version the method was added. + // + // optional string method_added_in = 93001; + E_MethodAddedIn = &file_cosmos_proto_cosmos_proto_extTypes[0] +) + // Extension fields to descriptorpb.MessageOptions. var ( // implements_interface is used to indicate the type name of the interface @@ -266,7 +306,11 @@ var ( // file option. // // repeated string implements_interface = 93001; - E_ImplementsInterface = &file_cosmos_proto_cosmos_proto_extTypes[0] + E_ImplementsInterface = &file_cosmos_proto_cosmos_proto_extTypes[1] + // message_added_in is used to indicate from which version the message was added. + // + // optional string message_added_in = 93002; + E_MessageAddedIn = &file_cosmos_proto_cosmos_proto_extTypes[2] ) // Extension fields to descriptorpb.FieldOptions. @@ -276,14 +320,18 @@ var ( // Interfaces should be declared using a declare_interface file option. // // optional string accepts_interface = 93001; - E_AcceptsInterface = &file_cosmos_proto_cosmos_proto_extTypes[1] + E_AcceptsInterface = &file_cosmos_proto_cosmos_proto_extTypes[3] // scalar is used to indicate that this field follows the formatting defined // by the named scalar which should be declared with declare_scalar. Code // generators may choose to use this information to map this field to a // language-specific type representing the scalar. // // optional string scalar = 93002; - E_Scalar = &file_cosmos_proto_cosmos_proto_extTypes[2] + E_Scalar = &file_cosmos_proto_cosmos_proto_extTypes[4] + // field_added_in is used to indicate from which version the field was added. + // + // optional string field_added_in = 93003; + E_FieldAddedIn = &file_cosmos_proto_cosmos_proto_extTypes[5] ) // Extension fields to descriptorpb.FileOptions. @@ -296,7 +344,7 @@ var ( // a/b/interfaces.proto in the file descriptor set. // // repeated cosmos_proto.InterfaceDescriptor declare_interface = 793021; - E_DeclareInterface = &file_cosmos_proto_cosmos_proto_extTypes[3] + E_DeclareInterface = &file_cosmos_proto_cosmos_proto_extTypes[6] // declare_scalar declares a scalar type to be used with // the scalar field option. Scalar names are // expected to follow the following convention such that their declaration @@ -305,7 +353,11 @@ var ( // a/b/scalars.proto in the file descriptor set. // // repeated cosmos_proto.ScalarDescriptor declare_scalar = 793022; - E_DeclareScalar = &file_cosmos_proto_cosmos_proto_extTypes[4] + E_DeclareScalar = &file_cosmos_proto_cosmos_proto_extTypes[7] + // file_added_in is used to indicate from which the version the file was added. + // + // optional string file_added_in = 793023; + E_FileAddedIn = &file_cosmos_proto_cosmos_proto_extTypes[8] ) var File_cosmos_proto_cosmos_proto protoreflect.FileDescriptor @@ -334,45 +386,63 @@ var file_cosmos_proto_cosmos_proto_rawDesc = []byte{ 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x43, 0x41, 0x4c, 0x41, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x43, 0x41, 0x4c, 0x41, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, - 0x59, 0x54, 0x45, 0x53, 0x10, 0x02, 0x3a, 0x54, 0x0a, 0x14, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x1f, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0xc9, 0xd6, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x3a, 0x4c, 0x0a, 0x11, - 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, - 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0xc9, 0xd6, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, - 0x73, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x3a, 0x37, 0x0a, 0x06, 0x73, 0x63, - 0x61, 0x6c, 0x61, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0xca, 0xd6, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x61, - 0x6c, 0x61, 0x72, 0x3a, 0x6e, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xbd, 0xb3, 0x30, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x52, 0x10, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, - 0x61, 0x63, 0x65, 0x3a, 0x65, 0x0a, 0x0e, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x73, - 0x63, 0x61, 0x6c, 0x61, 0x72, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0xbe, 0xb3, 0x30, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x63, 0x61, 0x6c, 0x61, - 0x72, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x0d, 0x64, 0x65, 0x63, - 0x6c, 0x61, 0x72, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x42, 0x9e, 0x01, 0x0a, 0x10, 0x63, - 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, - 0x0b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xca, 0x02, 0x0b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0xe2, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x59, 0x54, 0x45, 0x53, 0x10, 0x02, 0x3a, 0x48, 0x0a, 0x0f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xc9, 0xd6, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x64, 0x64, 0x65, 0x64, 0x49, 0x6e, + 0x3a, 0x54, 0x0a, 0x14, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xc9, 0xd6, 0x05, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x13, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x3a, 0x4b, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xca, 0xd6, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x64, 0x64, 0x65, + 0x64, 0x49, 0x6e, 0x3a, 0x4c, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x73, 0x5f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xc9, 0xd6, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x3a, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xca, 0xd6, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x3a, 0x45, 0x0a, 0x0e, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x12, 0x1d, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xcb, 0xd6, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x64, 0x64, 0x65, 0x64, 0x49, + 0x6e, 0x3a, 0x6e, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xbd, 0xb3, 0x30, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, + 0x10, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x3a, 0x65, 0x0a, 0x0e, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x73, 0x63, 0x61, + 0x6c, 0x61, 0x72, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0xbe, 0xb3, 0x30, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x0d, 0x64, 0x65, 0x63, 0x6c, 0x61, + 0x72, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x3a, 0x42, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x65, + 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xbf, 0xb3, 0x30, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x41, 0x64, 0x64, 0x65, 0x64, 0x49, 0x6e, 0x42, 0x9e, 0x01, 0x0a, + 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x42, 0x0b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xca, 0x02, 0x0b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xe2, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -393,24 +463,29 @@ var file_cosmos_proto_cosmos_proto_goTypes = []interface{}{ (ScalarType)(0), // 0: cosmos_proto.ScalarType (*InterfaceDescriptor)(nil), // 1: cosmos_proto.InterfaceDescriptor (*ScalarDescriptor)(nil), // 2: cosmos_proto.ScalarDescriptor - (*descriptorpb.MessageOptions)(nil), // 3: google.protobuf.MessageOptions - (*descriptorpb.FieldOptions)(nil), // 4: google.protobuf.FieldOptions - (*descriptorpb.FileOptions)(nil), // 5: google.protobuf.FileOptions + (*descriptorpb.MethodOptions)(nil), // 3: google.protobuf.MethodOptions + (*descriptorpb.MessageOptions)(nil), // 4: google.protobuf.MessageOptions + (*descriptorpb.FieldOptions)(nil), // 5: google.protobuf.FieldOptions + (*descriptorpb.FileOptions)(nil), // 6: google.protobuf.FileOptions } var file_cosmos_proto_cosmos_proto_depIdxs = []int32{ - 0, // 0: cosmos_proto.ScalarDescriptor.field_type:type_name -> cosmos_proto.ScalarType - 3, // 1: cosmos_proto.implements_interface:extendee -> google.protobuf.MessageOptions - 4, // 2: cosmos_proto.accepts_interface:extendee -> google.protobuf.FieldOptions - 4, // 3: cosmos_proto.scalar:extendee -> google.protobuf.FieldOptions - 5, // 4: cosmos_proto.declare_interface:extendee -> google.protobuf.FileOptions - 5, // 5: cosmos_proto.declare_scalar:extendee -> google.protobuf.FileOptions - 1, // 6: cosmos_proto.declare_interface:type_name -> cosmos_proto.InterfaceDescriptor - 2, // 7: cosmos_proto.declare_scalar:type_name -> cosmos_proto.ScalarDescriptor - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 6, // [6:8] is the sub-list for extension type_name - 1, // [1:6] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 0, // 0: cosmos_proto.ScalarDescriptor.field_type:type_name -> cosmos_proto.ScalarType + 3, // 1: cosmos_proto.method_added_in:extendee -> google.protobuf.MethodOptions + 4, // 2: cosmos_proto.implements_interface:extendee -> google.protobuf.MessageOptions + 4, // 3: cosmos_proto.message_added_in:extendee -> google.protobuf.MessageOptions + 5, // 4: cosmos_proto.accepts_interface:extendee -> google.protobuf.FieldOptions + 5, // 5: cosmos_proto.scalar:extendee -> google.protobuf.FieldOptions + 5, // 6: cosmos_proto.field_added_in:extendee -> google.protobuf.FieldOptions + 6, // 7: cosmos_proto.declare_interface:extendee -> google.protobuf.FileOptions + 6, // 8: cosmos_proto.declare_scalar:extendee -> google.protobuf.FileOptions + 6, // 9: cosmos_proto.file_added_in:extendee -> google.protobuf.FileOptions + 1, // 10: cosmos_proto.declare_interface:type_name -> cosmos_proto.InterfaceDescriptor + 2, // 11: cosmos_proto.declare_scalar:type_name -> cosmos_proto.ScalarDescriptor + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 10, // [10:12] is the sub-list for extension type_name + 1, // [1:10] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_cosmos_proto_cosmos_proto_init() } @@ -451,7 +526,7 @@ func file_cosmos_proto_cosmos_proto_init() { RawDescriptor: file_cosmos_proto_cosmos_proto_rawDesc, NumEnums: 1, NumMessages: 2, - NumExtensions: 5, + NumExtensions: 9, NumServices: 0, }, GoTypes: file_cosmos_proto_cosmos_proto_goTypes, diff --git a/proto/cosmos_proto/cosmos.proto b/proto/cosmos_proto/cosmos.proto index 5c63b86..4fb5815 100644 --- a/proto/cosmos_proto/cosmos.proto +++ b/proto/cosmos_proto/cosmos.proto @@ -5,6 +5,12 @@ import "google/protobuf/descriptor.proto"; option go_package = "github.com/cosmos/cosmos-proto;cosmos_proto"; +extend google.protobuf.MethodOptions { + + // method_added_in is used to indicate from which version the method was added. + string method_added_in = 93001; +} + extend google.protobuf.MessageOptions { // implements_interface is used to indicate the type name of the interface @@ -13,6 +19,9 @@ extend google.protobuf.MessageOptions { // interfaces. Interfaces should be declared using a declare_interface // file option. repeated string implements_interface = 93001; + + // message_added_in is used to indicate from which version the message was added. + string message_added_in = 93002; } extend google.protobuf.FieldOptions { @@ -27,6 +36,9 @@ extend google.protobuf.FieldOptions { // generators may choose to use this information to map this field to a // language-specific type representing the scalar. string scalar = 93002; + + // field_added_in is used to indicate from which version the field was added. + string field_added_in = 93003; } extend google.protobuf.FileOptions { @@ -46,6 +58,9 @@ extend google.protobuf.FileOptions { // expected that the declaration will be found in a protobuf file named // a/b/scalars.proto in the file descriptor set. repeated ScalarDescriptor declare_scalar = 793022; + + // file_added_in is used to indicate from which the version the file was added. + string file_added_in = 793023; } // InterfaceDescriptor describes an interface type to be used with @@ -94,4 +109,4 @@ enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0; SCALAR_TYPE_STRING = 1; SCALAR_TYPE_BYTES = 2; -} +} \ No newline at end of file diff --git a/testpb/1.proto b/testpb/1.proto index bd9185d..15ced1c 100644 --- a/testpb/1.proto +++ b/testpb/1.proto @@ -1,6 +1,6 @@ syntax="proto3"; -import "testpb/2.proto"; +import "2.proto"; option go_package = "github.com/cosmos/cosmos-proto/testpb"; diff --git a/testpb/1.pulsar.go b/testpb/1.pulsar.go index 1397f0f..b44c0e5 100644 --- a/testpb/1.pulsar.go +++ b/testpb/1.pulsar.go @@ -231,8 +231,8 @@ var ( ) func init() { - file_testpb_1_proto_init() - md_A = File_testpb_1_proto.Messages().ByName("A") + file__1_proto_init() + md_A = File__1_proto.Messages().ByName("A") fd_A_enum = md_A.Fields().ByName("enum") fd_A_some_boolean = md_A.Fields().ByName("some_boolean") fd_A_INT32 = md_A.Fields().ByName("INT32") @@ -268,7 +268,7 @@ func (x *A) ProtoReflect() protoreflect.Message { } func (x *A) slowProtoReflect() protoreflect.Message { - mi := &file_testpb_1_proto_msgTypes[0] + mi := &file__1_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2218,8 +2218,8 @@ var ( ) func init() { - file_testpb_1_proto_init() - md_B = File_testpb_1_proto.Messages().ByName("B") + file__1_proto_init() + md_B = File__1_proto.Messages().ByName("B") fd_B_x = md_B.Fields().ByName("x") } @@ -2232,7 +2232,7 @@ func (x *B) ProtoReflect() protoreflect.Message { } func (x *B) slowProtoReflect() protoreflect.Message { - mi := &file_testpb_1_proto_msgTypes[1] + mi := &file__1_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2635,8 +2635,8 @@ func (x *fastReflection_B) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc v3.18.1 -// source: testpb/1.proto +// protoc (unknown) +// source: 1.proto const ( // Verify that this generated code is sufficiently up-to-date. @@ -2675,11 +2675,11 @@ func (x Enumeration) String() string { } func (Enumeration) Descriptor() protoreflect.EnumDescriptor { - return file_testpb_1_proto_enumTypes[0].Descriptor() + return file__1_proto_enumTypes[0].Descriptor() } func (Enumeration) Type() protoreflect.EnumType { - return &file_testpb_1_proto_enumTypes[0] + return &file__1_proto_enumTypes[0] } func (x Enumeration) Number() protoreflect.EnumNumber { @@ -2688,7 +2688,7 @@ func (x Enumeration) Number() protoreflect.EnumNumber { // Deprecated: Use Enumeration.Descriptor instead. func (Enumeration) EnumDescriptor() ([]byte, []int) { - return file_testpb_1_proto_rawDescGZIP(), []int{0} + return file__1_proto_rawDescGZIP(), []int{0} } type A struct { @@ -2716,6 +2716,7 @@ type A struct { MAP map[string]*B `protobuf:"bytes,18,rep,name=MAP,proto3" json:"MAP,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` LIST []*B `protobuf:"bytes,19,rep,name=LIST,proto3" json:"LIST,omitempty"` // Types that are assignable to ONEOF: + // // *A_ONEOF_B // *A_ONEOF_STRING ONEOF isA_ONEOF `protobuf_oneof:"ONEOF"` @@ -2727,7 +2728,7 @@ type A struct { func (x *A) Reset() { *x = A{} if protoimpl.UnsafeEnabled { - mi := &file_testpb_1_proto_msgTypes[0] + mi := &file__1_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2741,7 +2742,7 @@ func (*A) ProtoMessage() {} // Deprecated: Use A.ProtoReflect.Descriptor instead. func (*A) Descriptor() ([]byte, []int) { - return file_testpb_1_proto_rawDescGZIP(), []int{0} + return file__1_proto_rawDescGZIP(), []int{0} } func (x *A) GetEnum() Enumeration { @@ -2946,7 +2947,7 @@ type B struct { func (x *B) Reset() { *x = B{} if protoimpl.UnsafeEnabled { - mi := &file_testpb_1_proto_msgTypes[1] + mi := &file__1_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2960,7 +2961,7 @@ func (*B) ProtoMessage() {} // Deprecated: Use B.ProtoReflect.Descriptor instead. func (*B) Descriptor() ([]byte, []int) { - return file_testpb_1_proto_rawDescGZIP(), []int{1} + return file__1_proto_rawDescGZIP(), []int{1} } func (x *B) GetX() string { @@ -2970,88 +2971,88 @@ func (x *B) GetX() string { return "" } -var File_testpb_1_proto protoreflect.FileDescriptor - -var file_testpb_1_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x0e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0xe7, 0x05, 0x0a, 0x01, 0x41, 0x12, 0x20, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x6f, 0x6d, 0x65, - 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x73, 0x6f, 0x6d, 0x65, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x49, - 0x4e, 0x54, 0x33, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x49, 0x4e, 0x54, 0x33, - 0x32, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x11, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, - 0x54, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x33, - 0x32, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x47, 0x36, - 0x34, 0x18, 0x07, 0x20, 0x01, 0x28, 0x12, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x47, 0x36, 0x34, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, - 0x44, 0x33, 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, - 0x44, 0x33, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x07, 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x14, 0x0a, - 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x46, 0x4c, - 0x4f, 0x41, 0x54, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x10, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, - 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x06, - 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x4f, 0x55, - 0x42, 0x4c, 0x45, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, - 0x45, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x59, 0x54, - 0x45, 0x53, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x12, - 0x1c, 0x0a, 0x07, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x02, 0x2e, 0x42, 0x52, 0x07, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x12, 0x1d, 0x0a, - 0x03, 0x4d, 0x41, 0x50, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x41, 0x2e, 0x4d, - 0x41, 0x50, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x4d, 0x41, 0x50, 0x12, 0x16, 0x0a, 0x04, - 0x4c, 0x49, 0x53, 0x54, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x42, 0x52, 0x04, - 0x4c, 0x49, 0x53, 0x54, 0x12, 0x1d, 0x0a, 0x07, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x5f, 0x42, 0x18, - 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x42, 0x48, 0x00, 0x52, 0x06, 0x4f, 0x4e, 0x45, - 0x4f, 0x46, 0x42, 0x12, 0x23, 0x0a, 0x0c, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x5f, 0x53, 0x54, 0x52, - 0x49, 0x4e, 0x47, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x4f, 0x4e, 0x45, - 0x4f, 0x46, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x12, 0x29, 0x0a, 0x09, 0x4c, 0x49, 0x53, 0x54, - 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x4c, 0x49, 0x53, 0x54, 0x45, - 0x4e, 0x55, 0x4d, 0x12, 0x2c, 0x0a, 0x08, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, - 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0x3a, 0x0a, 0x08, 0x4d, 0x41, 0x50, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x42, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x22, 0x11, 0x0a, 0x01, 0x42, 0x12, - 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x78, 0x2a, 0x1f, 0x0a, - 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x07, 0x0a, 0x03, - 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, 0x42, 0x27, - 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File__1_proto protoreflect.FileDescriptor + +var file__1_proto_rawDesc = []byte{ + 0x0a, 0x07, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x07, 0x32, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xe7, 0x05, 0x0a, 0x01, 0x41, 0x12, 0x20, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x6f, + 0x6d, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0b, 0x73, 0x6f, 0x6d, 0x65, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x14, 0x0a, + 0x05, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x49, 0x4e, + 0x54, 0x33, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x11, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x55, + 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x55, 0x49, 0x4e, + 0x54, 0x33, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, + 0x47, 0x36, 0x34, 0x18, 0x07, 0x20, 0x01, 0x28, 0x12, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x47, 0x36, + 0x34, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, + 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x08, 0x53, 0x46, 0x49, + 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x07, 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, + 0x14, 0x0a, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, + 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, + 0x34, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x10, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, + 0x34, 0x12, 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x06, 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x16, 0x0a, 0x06, 0x44, + 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x44, 0x4f, 0x55, + 0x42, 0x4c, 0x45, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x18, 0x0f, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x12, 0x14, 0x0a, 0x05, 0x42, + 0x59, 0x54, 0x45, 0x53, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x42, 0x59, 0x54, 0x45, + 0x53, 0x12, 0x1c, 0x0a, 0x07, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x42, 0x52, 0x07, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x12, + 0x1d, 0x0a, 0x03, 0x4d, 0x41, 0x50, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x41, + 0x2e, 0x4d, 0x41, 0x50, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x4d, 0x41, 0x50, 0x12, 0x16, + 0x0a, 0x04, 0x4c, 0x49, 0x53, 0x54, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x42, + 0x52, 0x04, 0x4c, 0x49, 0x53, 0x54, 0x12, 0x1d, 0x0a, 0x07, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x5f, + 0x42, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x42, 0x48, 0x00, 0x52, 0x06, 0x4f, + 0x4e, 0x45, 0x4f, 0x46, 0x42, 0x12, 0x23, 0x0a, 0x0c, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x5f, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x4f, + 0x4e, 0x45, 0x4f, 0x46, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x12, 0x29, 0x0a, 0x09, 0x4c, 0x49, + 0x53, 0x54, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0c, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x4c, 0x49, 0x53, + 0x54, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x2c, 0x0a, 0x08, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x69, 0x6d, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x18, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0x3a, 0x0a, 0x08, 0x4d, 0x41, 0x50, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x42, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x22, 0x11, 0x0a, 0x01, + 0x42, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x78, 0x2a, + 0x1f, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x07, + 0x0a, 0x03, 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, + 0x42, 0x31, 0x42, 0x06, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_testpb_1_proto_rawDescOnce sync.Once - file_testpb_1_proto_rawDescData = file_testpb_1_proto_rawDesc + file__1_proto_rawDescOnce sync.Once + file__1_proto_rawDescData = file__1_proto_rawDesc ) -func file_testpb_1_proto_rawDescGZIP() []byte { - file_testpb_1_proto_rawDescOnce.Do(func() { - file_testpb_1_proto_rawDescData = protoimpl.X.CompressGZIP(file_testpb_1_proto_rawDescData) +func file__1_proto_rawDescGZIP() []byte { + file__1_proto_rawDescOnce.Do(func() { + file__1_proto_rawDescData = protoimpl.X.CompressGZIP(file__1_proto_rawDescData) }) - return file_testpb_1_proto_rawDescData + return file__1_proto_rawDescData } -var file_testpb_1_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_testpb_1_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_testpb_1_proto_goTypes = []interface{}{ +var file__1_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file__1_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file__1_proto_goTypes = []interface{}{ (Enumeration)(0), // 0: Enumeration (*A)(nil), // 1: A (*B)(nil), // 2: B nil, // 3: A.MAPEntry (*ImportedMessage)(nil), // 4: ImportedMessage } -var file_testpb_1_proto_depIdxs = []int32{ +var file__1_proto_depIdxs = []int32{ 0, // 0: A.enum:type_name -> Enumeration 2, // 1: A.MESSAGE:type_name -> B 3, // 2: A.MAP:type_name -> A.MAPEntry @@ -3067,14 +3068,14 @@ var file_testpb_1_proto_depIdxs = []int32{ 0, // [0:8] is the sub-list for field type_name } -func init() { file_testpb_1_proto_init() } -func file_testpb_1_proto_init() { - if File_testpb_1_proto != nil { +func init() { file__1_proto_init() } +func file__1_proto_init() { + if File__1_proto != nil { return } - file_testpb_2_proto_init() + file__2_proto_init() if !protoimpl.UnsafeEnabled { - file_testpb_1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file__1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*A); i { case 0: return &v.state @@ -3086,7 +3087,7 @@ func file_testpb_1_proto_init() { return nil } } - file_testpb_1_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file__1_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*B); i { case 0: return &v.state @@ -3099,7 +3100,7 @@ func file_testpb_1_proto_init() { } } } - file_testpb_1_proto_msgTypes[0].OneofWrappers = []interface{}{ + file__1_proto_msgTypes[0].OneofWrappers = []interface{}{ (*A_ONEOF_B)(nil), (*A_ONEOF_STRING)(nil), } @@ -3107,19 +3108,19 @@ func file_testpb_1_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testpb_1_proto_rawDesc, + RawDescriptor: file__1_proto_rawDesc, NumEnums: 1, NumMessages: 3, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_testpb_1_proto_goTypes, - DependencyIndexes: file_testpb_1_proto_depIdxs, - EnumInfos: file_testpb_1_proto_enumTypes, - MessageInfos: file_testpb_1_proto_msgTypes, + GoTypes: file__1_proto_goTypes, + DependencyIndexes: file__1_proto_depIdxs, + EnumInfos: file__1_proto_enumTypes, + MessageInfos: file__1_proto_msgTypes, }.Build() - File_testpb_1_proto = out.File - file_testpb_1_proto_rawDesc = nil - file_testpb_1_proto_goTypes = nil - file_testpb_1_proto_depIdxs = nil + File__1_proto = out.File + file__1_proto_rawDesc = nil + file__1_proto_goTypes = nil + file__1_proto_depIdxs = nil } diff --git a/testpb/2.proto b/testpb/2.proto index 1183687..ae549dd 100644 --- a/testpb/2.proto +++ b/testpb/2.proto @@ -1,4 +1,5 @@ syntax="proto3"; + option go_package = "github.com/cosmos/cosmos-proto/testpb"; message ImportedMessage { diff --git a/testpb/2.pulsar.go b/testpb/2.pulsar.go index cb2aac9..c2bb321 100644 --- a/testpb/2.pulsar.go +++ b/testpb/2.pulsar.go @@ -17,8 +17,8 @@ var ( ) func init() { - file_testpb_2_proto_init() - md_ImportedMessage = File_testpb_2_proto.Messages().ByName("ImportedMessage") + file__2_proto_init() + md_ImportedMessage = File__2_proto.Messages().ByName("ImportedMessage") } var _ protoreflect.Message = (*fastReflection_ImportedMessage)(nil) @@ -30,7 +30,7 @@ func (x *ImportedMessage) ProtoReflect() protoreflect.Message { } func (x *ImportedMessage) slowProtoReflect() protoreflect.Message { - mi := &file_testpb_2_proto_msgTypes[0] + mi := &file__2_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -371,8 +371,8 @@ func (x *fastReflection_ImportedMessage) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc v3.18.1 -// source: testpb/2.proto +// protoc (unknown) +// source: 2.proto const ( // Verify that this generated code is sufficiently up-to-date. @@ -390,7 +390,7 @@ type ImportedMessage struct { func (x *ImportedMessage) Reset() { *x = ImportedMessage{} if protoimpl.UnsafeEnabled { - mi := &file_testpb_2_proto_msgTypes[0] + mi := &file__2_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -404,37 +404,37 @@ func (*ImportedMessage) ProtoMessage() {} // Deprecated: Use ImportedMessage.ProtoReflect.Descriptor instead. func (*ImportedMessage) Descriptor() ([]byte, []int) { - return file_testpb_2_proto_rawDescGZIP(), []int{0} + return file__2_proto_rawDescGZIP(), []int{0} } -var File_testpb_2_proto protoreflect.FileDescriptor +var File__2_proto protoreflect.FileDescriptor -var file_testpb_2_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x11, 0x0a, 0x0f, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, +var file__2_proto_rawDesc = []byte{ + 0x0a, 0x07, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x11, 0x0a, 0x0f, 0x49, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x31, 0x42, 0x06, + 0x32, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_testpb_2_proto_rawDescOnce sync.Once - file_testpb_2_proto_rawDescData = file_testpb_2_proto_rawDesc + file__2_proto_rawDescOnce sync.Once + file__2_proto_rawDescData = file__2_proto_rawDesc ) -func file_testpb_2_proto_rawDescGZIP() []byte { - file_testpb_2_proto_rawDescOnce.Do(func() { - file_testpb_2_proto_rawDescData = protoimpl.X.CompressGZIP(file_testpb_2_proto_rawDescData) +func file__2_proto_rawDescGZIP() []byte { + file__2_proto_rawDescOnce.Do(func() { + file__2_proto_rawDescData = protoimpl.X.CompressGZIP(file__2_proto_rawDescData) }) - return file_testpb_2_proto_rawDescData + return file__2_proto_rawDescData } -var file_testpb_2_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_testpb_2_proto_goTypes = []interface{}{ +var file__2_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file__2_proto_goTypes = []interface{}{ (*ImportedMessage)(nil), // 0: ImportedMessage } -var file_testpb_2_proto_depIdxs = []int32{ +var file__2_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -442,13 +442,13 @@ var file_testpb_2_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_testpb_2_proto_init() } -func file_testpb_2_proto_init() { - if File_testpb_2_proto != nil { +func init() { file__2_proto_init() } +func file__2_proto_init() { + if File__2_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_testpb_2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file__2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ImportedMessage); i { case 0: return &v.state @@ -465,18 +465,18 @@ func file_testpb_2_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testpb_2_proto_rawDesc, + RawDescriptor: file__2_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_testpb_2_proto_goTypes, - DependencyIndexes: file_testpb_2_proto_depIdxs, - MessageInfos: file_testpb_2_proto_msgTypes, + GoTypes: file__2_proto_goTypes, + DependencyIndexes: file__2_proto_depIdxs, + MessageInfos: file__2_proto_msgTypes, }.Build() - File_testpb_2_proto = out.File - file_testpb_2_proto_rawDesc = nil - file_testpb_2_proto_goTypes = nil - file_testpb_2_proto_depIdxs = nil + File__2_proto = out.File + file__2_proto_rawDesc = nil + file__2_proto_goTypes = nil + file__2_proto_depIdxs = nil } diff --git a/testpb/3.proto b/testpb/3.proto new file mode 100644 index 0000000..9aa5ce4 --- /dev/null +++ b/testpb/3.proto @@ -0,0 +1,23 @@ +syntax="proto3"; + +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-proto/testpb"; + +// QueryService defines the gRPC querier service. +service QueryService { + // CounterQuery queries a counter. + rpc CounterQuery(CounterQueryRequest) returns (CounterQueryResponse) { + option (cosmos_proto.method_added_in) = "github.com/cosmos/cosmos-proto v1.0.1"; + } +} + +// CounterQueryRequest defines the request type used to query the counter. +message CounterQueryRequest {} + +// CounterQueryResponse defines the response type for querying the counter. +message CounterQueryResponse { + option (cosmos_proto.message_added_in) = "github.com/cosmos/cosmos-proto v1.0.1"; + + uint64 counter = 1 [(cosmos_proto.field_added_in) = "github.com/cosmos/cosmos-proto v1.0.1"]; +} \ No newline at end of file diff --git a/testpb/3.pulsar.go b/testpb/3.pulsar.go new file mode 100644 index 0000000..fba27bc --- /dev/null +++ b/testpb/3.pulsar.go @@ -0,0 +1,957 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package testpb + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_CounterQueryRequest protoreflect.MessageDescriptor +) + +func init() { + file__3_proto_init() + md_CounterQueryRequest = File__3_proto.Messages().ByName("CounterQueryRequest") +} + +var _ protoreflect.Message = (*fastReflection_CounterQueryRequest)(nil) + +type fastReflection_CounterQueryRequest CounterQueryRequest + +func (x *CounterQueryRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_CounterQueryRequest)(x) +} + +func (x *CounterQueryRequest) slowProtoReflect() protoreflect.Message { + mi := &file__3_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_CounterQueryRequest_messageType fastReflection_CounterQueryRequest_messageType +var _ protoreflect.MessageType = fastReflection_CounterQueryRequest_messageType{} + +type fastReflection_CounterQueryRequest_messageType struct{} + +func (x fastReflection_CounterQueryRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_CounterQueryRequest)(nil) +} +func (x fastReflection_CounterQueryRequest_messageType) New() protoreflect.Message { + return new(fastReflection_CounterQueryRequest) +} +func (x fastReflection_CounterQueryRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_CounterQueryRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_CounterQueryRequest) Descriptor() protoreflect.MessageDescriptor { + return md_CounterQueryRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_CounterQueryRequest) Type() protoreflect.MessageType { + return _fastReflection_CounterQueryRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_CounterQueryRequest) New() protoreflect.Message { + return new(fastReflection_CounterQueryRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_CounterQueryRequest) Interface() protoreflect.ProtoMessage { + return (*CounterQueryRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_CounterQueryRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_CounterQueryRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryRequest")) + } + panic(fmt.Errorf("message CounterQueryRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryRequest")) + } + panic(fmt.Errorf("message CounterQueryRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_CounterQueryRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryRequest")) + } + panic(fmt.Errorf("message CounterQueryRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryRequest")) + } + panic(fmt.Errorf("message CounterQueryRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryRequest")) + } + panic(fmt.Errorf("message CounterQueryRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_CounterQueryRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryRequest")) + } + panic(fmt.Errorf("message CounterQueryRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_CounterQueryRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in CounterQueryRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_CounterQueryRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_CounterQueryRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_CounterQueryRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*CounterQueryRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*CounterQueryRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*CounterQueryRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CounterQueryRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CounterQueryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_CounterQueryResponse protoreflect.MessageDescriptor + fd_CounterQueryResponse_counter protoreflect.FieldDescriptor +) + +func init() { + file__3_proto_init() + md_CounterQueryResponse = File__3_proto.Messages().ByName("CounterQueryResponse") + fd_CounterQueryResponse_counter = md_CounterQueryResponse.Fields().ByName("counter") +} + +var _ protoreflect.Message = (*fastReflection_CounterQueryResponse)(nil) + +type fastReflection_CounterQueryResponse CounterQueryResponse + +func (x *CounterQueryResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_CounterQueryResponse)(x) +} + +func (x *CounterQueryResponse) slowProtoReflect() protoreflect.Message { + mi := &file__3_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_CounterQueryResponse_messageType fastReflection_CounterQueryResponse_messageType +var _ protoreflect.MessageType = fastReflection_CounterQueryResponse_messageType{} + +type fastReflection_CounterQueryResponse_messageType struct{} + +func (x fastReflection_CounterQueryResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_CounterQueryResponse)(nil) +} +func (x fastReflection_CounterQueryResponse_messageType) New() protoreflect.Message { + return new(fastReflection_CounterQueryResponse) +} +func (x fastReflection_CounterQueryResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_CounterQueryResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_CounterQueryResponse) Descriptor() protoreflect.MessageDescriptor { + return md_CounterQueryResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_CounterQueryResponse) Type() protoreflect.MessageType { + return _fastReflection_CounterQueryResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_CounterQueryResponse) New() protoreflect.Message { + return new(fastReflection_CounterQueryResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_CounterQueryResponse) Interface() protoreflect.ProtoMessage { + return (*CounterQueryResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_CounterQueryResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Counter != uint64(0) { + value := protoreflect.ValueOfUint64(x.Counter) + if !f(fd_CounterQueryResponse_counter, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_CounterQueryResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "CounterQueryResponse.counter": + return x.Counter != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryResponse")) + } + panic(fmt.Errorf("message CounterQueryResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "CounterQueryResponse.counter": + x.Counter = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryResponse")) + } + panic(fmt.Errorf("message CounterQueryResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_CounterQueryResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "CounterQueryResponse.counter": + value := x.Counter + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryResponse")) + } + panic(fmt.Errorf("message CounterQueryResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "CounterQueryResponse.counter": + x.Counter = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryResponse")) + } + panic(fmt.Errorf("message CounterQueryResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "CounterQueryResponse.counter": + panic(fmt.Errorf("field counter of message CounterQueryResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryResponse")) + } + panic(fmt.Errorf("message CounterQueryResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_CounterQueryResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "CounterQueryResponse.counter": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CounterQueryResponse")) + } + panic(fmt.Errorf("message CounterQueryResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_CounterQueryResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in CounterQueryResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_CounterQueryResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_CounterQueryResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_CounterQueryResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_CounterQueryResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*CounterQueryResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Counter != 0 { + n += 1 + runtime.Sov(uint64(x.Counter)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*CounterQueryResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Counter != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Counter)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*CounterQueryResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CounterQueryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CounterQueryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Counter", wireType) + } + x.Counter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Counter |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: 3.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// CounterQueryRequest defines the request type used to query the counter. +type CounterQueryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CounterQueryRequest) Reset() { + *x = CounterQueryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file__3_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CounterQueryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CounterQueryRequest) ProtoMessage() {} + +// Deprecated: Use CounterQueryRequest.ProtoReflect.Descriptor instead. +func (*CounterQueryRequest) Descriptor() ([]byte, []int) { + return file__3_proto_rawDescGZIP(), []int{0} +} + +// CounterQueryResponse defines the response type for querying the counter. +type CounterQueryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Counter uint64 `protobuf:"varint,1,opt,name=counter,proto3" json:"counter,omitempty"` +} + +func (x *CounterQueryResponse) Reset() { + *x = CounterQueryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file__3_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CounterQueryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CounterQueryResponse) ProtoMessage() {} + +// Deprecated: Use CounterQueryResponse.ProtoReflect.Descriptor instead. +func (*CounterQueryResponse) Descriptor() ([]byte, []int) { + return file__3_proto_rawDescGZIP(), []int{1} +} + +func (x *CounterQueryResponse) GetCounter() uint64 { + if x != nil { + return x.Counter + } + return 0 +} + +var File__3_proto protoreflect.FileDescriptor + +var file__3_proto_rawDesc = []byte{ + 0x0a, 0x07, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a, 0x13, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x86, 0x01, 0x0a, 0x14, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x29, 0xda, 0xb4, 0x2d, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x76, 0x31, 0x2e, 0x30, 0x2e, 0x31, + 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x3a, 0x29, 0xd2, 0xb4, 0x2d, 0x25, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x76, 0x31, + 0x2e, 0x30, 0x2e, 0x31, 0x32, 0x76, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x66, 0x0a, 0x0c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x29, 0xca, 0xb4, 0x2d, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x20, 0x76, 0x31, 0x2e, 0x30, 0x2e, 0x31, 0x42, 0x31, 0x42, 0x06, + 0x33, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file__3_proto_rawDescOnce sync.Once + file__3_proto_rawDescData = file__3_proto_rawDesc +) + +func file__3_proto_rawDescGZIP() []byte { + file__3_proto_rawDescOnce.Do(func() { + file__3_proto_rawDescData = protoimpl.X.CompressGZIP(file__3_proto_rawDescData) + }) + return file__3_proto_rawDescData +} + +var file__3_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file__3_proto_goTypes = []interface{}{ + (*CounterQueryRequest)(nil), // 0: CounterQueryRequest + (*CounterQueryResponse)(nil), // 1: CounterQueryResponse +} +var file__3_proto_depIdxs = []int32{ + 0, // 0: QueryService.CounterQuery:input_type -> CounterQueryRequest + 1, // 1: QueryService.CounterQuery:output_type -> CounterQueryResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file__3_proto_init() } +func file__3_proto_init() { + if File__3_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file__3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CounterQueryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file__3_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CounterQueryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file__3_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file__3_proto_goTypes, + DependencyIndexes: file__3_proto_depIdxs, + MessageInfos: file__3_proto_msgTypes, + }.Build() + File__3_proto = out.File + file__3_proto_rawDesc = nil + file__3_proto_goTypes = nil + file__3_proto_depIdxs = nil +} diff --git a/testpb/added_in_test.go b/testpb/added_in_test.go new file mode 100644 index 0000000..8f22ec4 --- /dev/null +++ b/testpb/added_in_test.go @@ -0,0 +1,38 @@ +package testpb + +import ( + "testing" + + cosmos_proto "github.com/cosmos/cosmos-proto" + "google.golang.org/protobuf/proto" +) + +func TestMessageAddedIn(t *testing.T) { + resp := new(CounterQueryResponse) + desc := resp.ProtoReflect().Descriptor().Options() + + if !proto.HasExtension(desc, cosmos_proto.E_MessageAddedIn) { + t.Fatalf("message_added_in extension missing %v", resp) + } + + expectedVersion := "github.com/cosmos/cosmos-proto v1.0.1" + versionField := proto.GetExtension(desc, cosmos_proto.E_MessageAddedIn).(string) + if versionField != expectedVersion { + t.Fatalf("versionField: %s != expectedVersion: %s", versionField, expectedVersion) + } +} + +func TestFieldAddedIn(t *testing.T) { + resp := new(CounterQueryResponse) + desc := resp.ProtoReflect().Descriptor().Fields().ByName("counter").Options() + + if !proto.HasExtension(desc, cosmos_proto.E_FieldAddedIn) { + t.Fatalf("field_added_in extension missing %v", resp) + } + + expectedVersion := "github.com/cosmos/cosmos-proto v1.0.1" + versionField := proto.GetExtension(desc, cosmos_proto.E_FieldAddedIn).(string) + if versionField != expectedVersion { + t.Fatalf("versionField: %s != expectedVersion: %s", versionField, expectedVersion) + } +} diff --git a/testpb/buf.gen.yaml b/testpb/buf.gen.yaml new file mode 100644 index 0000000..e417bed --- /dev/null +++ b/testpb/buf.gen.yaml @@ -0,0 +1,7 @@ +version: v1 +managed: + enabled: true +plugins: + - name: go-pulsar + out: . + opt: paths=source_relative diff --git a/testpb/buf.lock b/testpb/buf.lock new file mode 100644 index 0000000..1c10386 --- /dev/null +++ b/testpb/buf.lock @@ -0,0 +1,8 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 diff --git a/testpb/buf.yaml b/testpb/buf.yaml new file mode 100644 index 0000000..d16f345 --- /dev/null +++ b/testpb/buf.yaml @@ -0,0 +1,3 @@ +version: v1 +deps: + - buf.build/cosmos/cosmos-proto