diff --git a/internal/api/metadata/server.go b/api/metadata/server.go similarity index 94% rename from internal/api/metadata/server.go rename to api/metadata/server.go index 9790a6bf2..a1874256c 100644 --- a/internal/api/metadata/server.go +++ b/api/metadata/server.go @@ -3,7 +3,7 @@ package metadata import ( "context" - "github.com/go-kratos/kratos/v2/api/kratos/api" + "github.com/go-kratos/kratos/v2/api/proto/kratos/api" "google.golang.org/grpc" anypb "google.golang.org/protobuf/types/known/anypb" ) diff --git a/internal/api/metadata/service.go b/api/metadata/service.go similarity index 96% rename from internal/api/metadata/service.go rename to api/metadata/service.go index 198c5c5d8..212b4c50d 100644 --- a/internal/api/metadata/service.go +++ b/api/metadata/service.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "io/ioutil" - "strings" "sync" "github.com/golang/protobuf/proto" @@ -112,13 +111,6 @@ func (s *Service) listServices() (map[string]*descriptorpb.FileDescriptorSet, er func fileDescriptorProto(path string) (*dpb.FileDescriptorProto, error) { fdenc := proto.FileDescriptor(path) - // fix proto path - if len(fdenc) == 0 { - idx := strings.LastIndex(path, "/") - if idx > 0 && idx+1 < len(path) { - fdenc = proto.FileDescriptor(path[idx+1:]) - } - } fdDep, err := decodeFileDesc(fdenc) if err != nil { return nil, err diff --git a/api/kratos/api/annotations.pb.go b/api/proto/kratos/api/annotations.pb.go similarity index 100% rename from api/kratos/api/annotations.pb.go rename to api/proto/kratos/api/annotations.pb.go diff --git a/api/kratos/api/annotations.proto b/api/proto/kratos/api/annotations.proto similarity index 100% rename from api/kratos/api/annotations.proto rename to api/proto/kratos/api/annotations.proto diff --git a/api/kratos/api/metadata.pb.go b/api/proto/kratos/api/metadata.pb.go similarity index 51% rename from api/kratos/api/metadata.pb.go rename to api/proto/kratos/api/metadata.pb.go index fa205fac2..a3551f8aa 100644 --- a/api/kratos/api/metadata.pb.go +++ b/api/proto/kratos/api/metadata.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.26.0 // protoc v3.15.8 -// source: metadata.proto +// source: kratos/api/metadata.proto package api @@ -34,7 +34,7 @@ type ListServicesReply struct { func (x *ListServicesReply) Reset() { *x = ListServicesReply{} if protoimpl.UnsafeEnabled { - mi := &file_metadata_proto_msgTypes[0] + mi := &file_kratos_api_metadata_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -47,7 +47,7 @@ func (x *ListServicesReply) String() string { func (*ListServicesReply) ProtoMessage() {} func (x *ListServicesReply) ProtoReflect() protoreflect.Message { - mi := &file_metadata_proto_msgTypes[0] + mi := &file_kratos_api_metadata_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -60,7 +60,7 @@ func (x *ListServicesReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ListServicesReply.ProtoReflect.Descriptor instead. func (*ListServicesReply) Descriptor() ([]byte, []int) { - return file_metadata_proto_rawDescGZIP(), []int{0} + return file_kratos_api_metadata_proto_rawDescGZIP(), []int{0} } func (x *ListServicesReply) GetServices() []string { @@ -81,7 +81,7 @@ type GetServiceMetaRequest struct { func (x *GetServiceMetaRequest) Reset() { *x = GetServiceMetaRequest{} if protoimpl.UnsafeEnabled { - mi := &file_metadata_proto_msgTypes[1] + mi := &file_kratos_api_metadata_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94,7 +94,7 @@ func (x *GetServiceMetaRequest) String() string { func (*GetServiceMetaRequest) ProtoMessage() {} func (x *GetServiceMetaRequest) ProtoReflect() protoreflect.Message { - mi := &file_metadata_proto_msgTypes[1] + mi := &file_kratos_api_metadata_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107,7 +107,7 @@ func (x *GetServiceMetaRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetServiceMetaRequest.ProtoReflect.Descriptor instead. func (*GetServiceMetaRequest) Descriptor() ([]byte, []int) { - return file_metadata_proto_rawDescGZIP(), []int{1} + return file_kratos_api_metadata_proto_rawDescGZIP(), []int{1} } func (x *GetServiceMetaRequest) GetName() string { @@ -128,7 +128,7 @@ type GetServiceMetaReply struct { func (x *GetServiceMetaReply) Reset() { *x = GetServiceMetaReply{} if protoimpl.UnsafeEnabled { - mi := &file_metadata_proto_msgTypes[2] + mi := &file_kratos_api_metadata_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -141,7 +141,7 @@ func (x *GetServiceMetaReply) String() string { func (*GetServiceMetaReply) ProtoMessage() {} func (x *GetServiceMetaReply) ProtoReflect() protoreflect.Message { - mi := &file_metadata_proto_msgTypes[2] + mi := &file_kratos_api_metadata_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -154,7 +154,7 @@ func (x *GetServiceMetaReply) ProtoReflect() protoreflect.Message { // Deprecated: Use GetServiceMetaReply.ProtoReflect.Descriptor instead. func (*GetServiceMetaReply) Descriptor() ([]byte, []int) { - return file_metadata_proto_rawDescGZIP(), []int{2} + return file_kratos_api_metadata_proto_rawDescGZIP(), []int{2} } func (x *GetServiceMetaReply) GetProtoSet() *descriptorpb.FileDescriptorSet { @@ -164,71 +164,72 @@ func (x *GetServiceMetaReply) GetProtoSet() *descriptorpb.FileDescriptorSet { return nil } -var File_metadata_proto protoreflect.FileDescriptor - -var file_metadata_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0a, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x19, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, +var File_kratos_api_metadata_proto protoreflect.FileDescriptor + +var file_kratos_api_metadata_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6b, 0x72, 0x61, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x22, 0x55, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x53, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x53, 0x65, 0x74, 0x32, 0xda, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x12, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x1a, 0x1d, 0x2e, 0x6b, 0x72, 0x61, + 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0b, 0x12, 0x09, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x76, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x21, + 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3e, 0x0a, 0x08, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x53, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, - 0x65, 0x74, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x53, 0x65, 0x74, 0x32, 0xda, 0x01, 0x0a, - 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x1a, - 0x1d, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x11, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x12, 0x76, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, - 0x65, 0x74, 0x61, 0x12, 0x21, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, - 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, - 0x18, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, - 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x58, 0x0a, 0x15, 0x63, 0x6f, 0x6d, - 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x6f, 0x2d, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, - 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, - 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0xa2, 0x02, 0x09, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, - 0x41, 0x50, 0x49, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x1a, 0x1f, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, + 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x42, 0x58, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x50, 0x01, 0x5a, + 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b, + 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x32, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x61, + 0x70, 0x69, 0xa2, 0x02, 0x09, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x41, 0x50, 0x49, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_metadata_proto_rawDescOnce sync.Once - file_metadata_proto_rawDescData = file_metadata_proto_rawDesc + file_kratos_api_metadata_proto_rawDescOnce sync.Once + file_kratos_api_metadata_proto_rawDescData = file_kratos_api_metadata_proto_rawDesc ) -func file_metadata_proto_rawDescGZIP() []byte { - file_metadata_proto_rawDescOnce.Do(func() { - file_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_metadata_proto_rawDescData) +func file_kratos_api_metadata_proto_rawDescGZIP() []byte { + file_kratos_api_metadata_proto_rawDescOnce.Do(func() { + file_kratos_api_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_kratos_api_metadata_proto_rawDescData) }) - return file_metadata_proto_rawDescData + return file_kratos_api_metadata_proto_rawDescData } -var file_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_metadata_proto_goTypes = []interface{}{ +var file_kratos_api_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_kratos_api_metadata_proto_goTypes = []interface{}{ (*ListServicesReply)(nil), // 0: kratos.api.ListServicesReply (*GetServiceMetaRequest)(nil), // 1: kratos.api.GetServiceMetaRequest (*GetServiceMetaReply)(nil), // 2: kratos.api.GetServiceMetaReply (*descriptorpb.FileDescriptorSet)(nil), // 3: google.protobuf.FileDescriptorSet (*anypb.Any)(nil), // 4: google.protobuf.Any } -var file_metadata_proto_depIdxs = []int32{ +var file_kratos_api_metadata_proto_depIdxs = []int32{ 3, // 0: kratos.api.GetServiceMetaReply.protoSet:type_name -> google.protobuf.FileDescriptorSet 4, // 1: kratos.api.Metadata.ListServices:input_type -> google.protobuf.Any 1, // 2: kratos.api.Metadata.GetServiceMeta:input_type -> kratos.api.GetServiceMetaRequest @@ -241,13 +242,13 @@ var file_metadata_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_metadata_proto_init() } -func file_metadata_proto_init() { - if File_metadata_proto != nil { +func init() { file_kratos_api_metadata_proto_init() } +func file_kratos_api_metadata_proto_init() { + if File_kratos_api_metadata_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_kratos_api_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListServicesReply); i { case 0: return &v.state @@ -259,7 +260,7 @@ func file_metadata_proto_init() { return nil } } - file_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_kratos_api_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetServiceMetaRequest); i { case 0: return &v.state @@ -271,7 +272,7 @@ func file_metadata_proto_init() { return nil } } - file_metadata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_kratos_api_metadata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetServiceMetaReply); i { case 0: return &v.state @@ -288,18 +289,18 @@ func file_metadata_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_metadata_proto_rawDesc, + RawDescriptor: file_kratos_api_metadata_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_metadata_proto_goTypes, - DependencyIndexes: file_metadata_proto_depIdxs, - MessageInfos: file_metadata_proto_msgTypes, + GoTypes: file_kratos_api_metadata_proto_goTypes, + DependencyIndexes: file_kratos_api_metadata_proto_depIdxs, + MessageInfos: file_kratos_api_metadata_proto_msgTypes, }.Build() - File_metadata_proto = out.File - file_metadata_proto_rawDesc = nil - file_metadata_proto_goTypes = nil - file_metadata_proto_depIdxs = nil + File_kratos_api_metadata_proto = out.File + file_kratos_api_metadata_proto_rawDesc = nil + file_kratos_api_metadata_proto_goTypes = nil + file_kratos_api_metadata_proto_depIdxs = nil } diff --git a/api/kratos/api/metadata.proto b/api/proto/kratos/api/metadata.proto similarity index 100% rename from api/kratos/api/metadata.proto rename to api/proto/kratos/api/metadata.proto diff --git a/api/kratos/api/metadata_grpc.pb.go b/api/proto/kratos/api/metadata_grpc.pb.go similarity index 98% rename from api/kratos/api/metadata_grpc.pb.go rename to api/proto/kratos/api/metadata_grpc.pb.go index 6dc0aac54..ee5128d69 100644 --- a/api/kratos/api/metadata_grpc.pb.go +++ b/api/proto/kratos/api/metadata_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.1.0 // - protoc v3.15.8 -// source: metadata.proto +// source: kratos/api/metadata.proto package api @@ -142,5 +142,5 @@ var Metadata_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "metadata.proto", + Metadata: "kratos/api/metadata.proto", } diff --git a/api/kratos/api/metadata_http.pb.go b/api/proto/kratos/api/metadata_http.pb.go similarity index 100% rename from api/kratos/api/metadata_http.pb.go rename to api/proto/kratos/api/metadata_http.pb.go diff --git a/transport/grpc/server.go b/transport/grpc/server.go index b74aa8212..7e15ce5c1 100644 --- a/transport/grpc/server.go +++ b/transport/grpc/server.go @@ -6,8 +6,8 @@ import ( "net" "time" - "github.com/go-kratos/kratos/v2/api/kratos/api" - "github.com/go-kratos/kratos/v2/internal/api/metadata" + "github.com/go-kratos/kratos/v2/api/metadata" + "github.com/go-kratos/kratos/v2/api/proto/kratos/api" "github.com/go-kratos/kratos/v2/internal/host" "github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/middleware"