diff --git a/main.go b/main.go index b97ac54..c3b739b 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,8 @@ */ //go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative proto/helloworld.proto +//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative proto/import.proto +//go:generate protoc --include_imports --descriptor_set_out=proto.pb --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative proto/src.proto // Package main implements a server for Greeter service. package main @@ -68,6 +70,7 @@ func init() { type server struct { // Embed the unimplemented server pb.UnimplementedGreeterServer + pb.UnimplementedTestImportServer } // SayHello implements helloworld.GreeterServer @@ -170,6 +173,10 @@ func (s *server) SayHelloBidirectionalStream(stream pb.Greeter_SayHelloBidirecti } } +func (s *server) Run(ctx context.Context, in *pb.Request) (*pb.Response, error) { + return &pb.Response{Body: in.User.Name + " " + in.Body}, nil +} + func main() { flag.Parse() @@ -181,6 +188,7 @@ func main() { s := grpc.NewServer() reflection.Register(s) pb.RegisterGreeterServer(s, &server{}) + pb.RegisterTestImportServer(s, &server{}) if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) } diff --git a/proto.pb b/proto.pb new file mode 100644 index 0000000..8edcc5c Binary files /dev/null and b/proto.pb differ diff --git a/proto/helloworld.pb.go b/proto/helloworld.pb.go index ccb4150..9cb2095 100644 --- a/proto/helloworld.pb.go +++ b/proto/helloworld.pb.go @@ -1,24 +1,38 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.6.1 // source: proto/helloworld.proto package proto import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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) +) type Gender int32 @@ -28,315 +42,532 @@ const ( Gender_GENDER_FEMALE Gender = 2 ) -var Gender_name = map[int32]string{ - 0: "GENDER_UNKNOWN", - 1: "GENDER_MALE", - 2: "GENDER_FEMALE", -} +// Enum value maps for Gender. +var ( + Gender_name = map[int32]string{ + 0: "GENDER_UNKNOWN", + 1: "GENDER_MALE", + 2: "GENDER_FEMALE", + } + Gender_value = map[string]int32{ + "GENDER_UNKNOWN": 0, + "GENDER_MALE": 1, + "GENDER_FEMALE": 2, + } +) -var Gender_value = map[string]int32{ - "GENDER_UNKNOWN": 0, - "GENDER_MALE": 1, - "GENDER_FEMALE": 2, +func (x Gender) Enum() *Gender { + p := new(Gender) + *p = x + return p } func (x Gender) String() string { - return proto.EnumName(Gender_name, int32(x)) + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (Gender) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_4d53fe9c48eadaad, []int{0} +func (Gender) Descriptor() protoreflect.EnumDescriptor { + return file_proto_helloworld_proto_enumTypes[0].Descriptor() } -type Person struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +func (Gender) Type() protoreflect.EnumType { + return &file_proto_helloworld_proto_enumTypes[0] } -func (m *Person) Reset() { *m = Person{} } -func (m *Person) String() string { return proto.CompactTextString(m) } -func (*Person) ProtoMessage() {} -func (*Person) Descriptor() ([]byte, []int) { - return fileDescriptor_4d53fe9c48eadaad, []int{0} +func (x Gender) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -func (m *Person) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Person.Unmarshal(m, b) +// Deprecated: Use Gender.Descriptor instead. +func (Gender) EnumDescriptor() ([]byte, []int) { + return file_proto_helloworld_proto_rawDescGZIP(), []int{0} } -func (m *Person) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Person.Marshal(b, m, deterministic) + +type Person struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` } -func (m *Person) XXX_Merge(src proto.Message) { - xxx_messageInfo_Person.Merge(m, src) + +func (x *Person) Reset() { + *x = Person{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_helloworld_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Person) XXX_Size() int { - return xxx_messageInfo_Person.Size(m) + +func (x *Person) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Person) XXX_DiscardUnknown() { - xxx_messageInfo_Person.DiscardUnknown(m) + +func (*Person) ProtoMessage() {} + +func (x *Person) ProtoReflect() protoreflect.Message { + mi := &file_proto_helloworld_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 xxx_messageInfo_Person proto.InternalMessageInfo +// Deprecated: Use Person.ProtoReflect.Descriptor instead. +func (*Person) Descriptor() ([]byte, []int) { + return file_proto_helloworld_proto_rawDescGZIP(), []int{0} +} -func (m *Person) GetName() string { - if m != nil { - return m.Name +func (x *Person) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Person) GetAge() int32 { - if m != nil { - return m.Age +func (x *Person) GetAge() int32 { + if x != nil { + return x.Age } return 0 } type HelloRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Items []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` - Gender Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"` - Person *Person `protobuf:"bytes,4,opt,name=person,proto3" json:"person,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HelloRequest) Reset() { *m = HelloRequest{} } -func (m *HelloRequest) String() string { return proto.CompactTextString(m) } -func (*HelloRequest) ProtoMessage() {} -func (*HelloRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_4d53fe9c48eadaad, []int{1} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + Gender Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"` + Person *Person `protobuf:"bytes,4,opt,name=person,proto3" json:"person,omitempty"` +} + +func (x *HelloRequest) Reset() { + *x = HelloRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_helloworld_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *HelloRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HelloRequest.Unmarshal(m, b) -} -func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic) -} -func (m *HelloRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HelloRequest.Merge(m, src) +func (x *HelloRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HelloRequest) XXX_Size() int { - return xxx_messageInfo_HelloRequest.Size(m) -} -func (m *HelloRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HelloRequest.DiscardUnknown(m) + +func (*HelloRequest) ProtoMessage() {} + +func (x *HelloRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_helloworld_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 xxx_messageInfo_HelloRequest proto.InternalMessageInfo +// Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead. +func (*HelloRequest) Descriptor() ([]byte, []int) { + return file_proto_helloworld_proto_rawDescGZIP(), []int{1} +} -func (m *HelloRequest) GetName() string { - if m != nil { - return m.Name +func (x *HelloRequest) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *HelloRequest) GetItems() []string { - if m != nil { - return m.Items +func (x *HelloRequest) GetItems() []string { + if x != nil { + return x.Items } return nil } -func (m *HelloRequest) GetGender() Gender { - if m != nil { - return m.Gender +func (x *HelloRequest) GetGender() Gender { + if x != nil { + return x.Gender } return Gender_GENDER_UNKNOWN } -func (m *HelloRequest) GetPerson() *Person { - if m != nil { - return m.Person +func (x *HelloRequest) GetPerson() *Person { + if x != nil { + return x.Person } return nil } type HelloReply struct { - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` - Items []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` - Gender Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *HelloReply) Reset() { *m = HelloReply{} } -func (m *HelloReply) String() string { return proto.CompactTextString(m) } -func (*HelloReply) ProtoMessage() {} -func (*HelloReply) Descriptor() ([]byte, []int) { - return fileDescriptor_4d53fe9c48eadaad, []int{2} + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Items []string `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + Gender Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=helloworld.Gender" json:"gender,omitempty"` } -func (m *HelloReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HelloReply.Unmarshal(m, b) -} -func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HelloReply.Marshal(b, m, deterministic) -} -func (m *HelloReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_HelloReply.Merge(m, src) +func (x *HelloReply) Reset() { + *x = HelloReply{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_helloworld_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *HelloReply) XXX_Size() int { - return xxx_messageInfo_HelloReply.Size(m) + +func (x *HelloReply) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *HelloReply) XXX_DiscardUnknown() { - xxx_messageInfo_HelloReply.DiscardUnknown(m) + +func (*HelloReply) ProtoMessage() {} + +func (x *HelloReply) ProtoReflect() protoreflect.Message { + mi := &file_proto_helloworld_proto_msgTypes[2] + 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 xxx_messageInfo_HelloReply proto.InternalMessageInfo +// Deprecated: Use HelloReply.ProtoReflect.Descriptor instead. +func (*HelloReply) Descriptor() ([]byte, []int) { + return file_proto_helloworld_proto_rawDescGZIP(), []int{2} +} -func (m *HelloReply) GetMessage() string { - if m != nil { - return m.Message +func (x *HelloReply) GetMessage() string { + if x != nil { + return x.Message } return "" } -func (m *HelloReply) GetItems() []string { - if m != nil { - return m.Items +func (x *HelloReply) GetItems() []string { + if x != nil { + return x.Items } return nil } -func (m *HelloReply) GetGender() Gender { - if m != nil { - return m.Gender +func (x *HelloReply) GetGender() Gender { + if x != nil { + return x.Gender } return Gender_GENDER_UNKNOWN } type PlusRequest struct { - A int64 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` - B int64 `protobuf:"varint,2,opt,name=b,proto3" json:"b,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *PlusRequest) Reset() { *m = PlusRequest{} } -func (m *PlusRequest) String() string { return proto.CompactTextString(m) } -func (*PlusRequest) ProtoMessage() {} -func (*PlusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_4d53fe9c48eadaad, []int{3} + A int64 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` + B int64 `protobuf:"varint,2,opt,name=b,proto3" json:"b,omitempty"` } -func (m *PlusRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PlusRequest.Unmarshal(m, b) -} -func (m *PlusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PlusRequest.Marshal(b, m, deterministic) -} -func (m *PlusRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlusRequest.Merge(m, src) +func (x *PlusRequest) Reset() { + *x = PlusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_helloworld_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PlusRequest) XXX_Size() int { - return xxx_messageInfo_PlusRequest.Size(m) + +func (x *PlusRequest) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PlusRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PlusRequest.DiscardUnknown(m) + +func (*PlusRequest) ProtoMessage() {} + +func (x *PlusRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_helloworld_proto_msgTypes[3] + 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 xxx_messageInfo_PlusRequest proto.InternalMessageInfo +// Deprecated: Use PlusRequest.ProtoReflect.Descriptor instead. +func (*PlusRequest) Descriptor() ([]byte, []int) { + return file_proto_helloworld_proto_rawDescGZIP(), []int{3} +} -func (m *PlusRequest) GetA() int64 { - if m != nil { - return m.A +func (x *PlusRequest) GetA() int64 { + if x != nil { + return x.A } return 0 } -func (m *PlusRequest) GetB() int64 { - if m != nil { - return m.B +func (x *PlusRequest) GetB() int64 { + if x != nil { + return x.B } return 0 } type PlusReply struct { - Result int64 `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *PlusReply) Reset() { *m = PlusReply{} } -func (m *PlusReply) String() string { return proto.CompactTextString(m) } -func (*PlusReply) ProtoMessage() {} -func (*PlusReply) Descriptor() ([]byte, []int) { - return fileDescriptor_4d53fe9c48eadaad, []int{4} + Result int64 `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` } -func (m *PlusReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PlusReply.Unmarshal(m, b) -} -func (m *PlusReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PlusReply.Marshal(b, m, deterministic) -} -func (m *PlusReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlusReply.Merge(m, src) +func (x *PlusReply) Reset() { + *x = PlusReply{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_helloworld_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *PlusReply) XXX_Size() int { - return xxx_messageInfo_PlusReply.Size(m) + +func (x *PlusReply) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *PlusReply) XXX_DiscardUnknown() { - xxx_messageInfo_PlusReply.DiscardUnknown(m) + +func (*PlusReply) ProtoMessage() {} + +func (x *PlusReply) ProtoReflect() protoreflect.Message { + mi := &file_proto_helloworld_proto_msgTypes[4] + 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 xxx_messageInfo_PlusReply proto.InternalMessageInfo +// Deprecated: Use PlusReply.ProtoReflect.Descriptor instead. +func (*PlusReply) Descriptor() ([]byte, []int) { + return file_proto_helloworld_proto_rawDescGZIP(), []int{4} +} -func (m *PlusReply) GetResult() int64 { - if m != nil { - return m.Result +func (x *PlusReply) GetResult() int64 { + if x != nil { + return x.Result } return 0 } -func init() { - proto.RegisterEnum("helloworld.Gender", Gender_name, Gender_value) - proto.RegisterType((*Person)(nil), "helloworld.Person") - proto.RegisterType((*HelloRequest)(nil), "helloworld.HelloRequest") - proto.RegisterType((*HelloReply)(nil), "helloworld.HelloReply") - proto.RegisterType((*PlusRequest)(nil), "helloworld.PlusRequest") - proto.RegisterType((*PlusReply)(nil), "helloworld.PlusReply") -} - -func init() { proto.RegisterFile("proto/helloworld.proto", fileDescriptor_4d53fe9c48eadaad) } - -var fileDescriptor_4d53fe9c48eadaad = []byte{ - // 419 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xbb, 0x71, 0xea, 0xe0, 0x49, 0x29, 0x61, 0x54, 0x82, 0x55, 0x2e, 0x96, 0xb9, 0x98, - 0x1e, 0xdc, 0xaa, 0x5c, 0x38, 0x21, 0x5a, 0x6a, 0x52, 0x89, 0x62, 0xaa, 0x8d, 0x2a, 0x24, 0x2e, - 0x68, 0x43, 0x86, 0xd6, 0xd2, 0xfa, 0x0f, 0xeb, 0x0d, 0xc8, 0x6f, 0xc1, 0x23, 0xf1, 0x68, 0xc8, - 0x6b, 0x5b, 0x75, 0x45, 0x4e, 0xc9, 0x29, 0x3b, 0x33, 0xdf, 0x7c, 0xf3, 0x9b, 0x89, 0x0c, 0xd3, - 0x42, 0xe5, 0x3a, 0x3f, 0xbe, 0x23, 0x29, 0xf3, 0xdf, 0xb9, 0x92, 0xcb, 0xd0, 0x24, 0x10, 0xee, - 0x33, 0x7e, 0x08, 0xf6, 0x35, 0xa9, 0x32, 0xcf, 0x10, 0x61, 0x98, 0x89, 0x94, 0x5c, 0xe6, 0xb1, - 0xc0, 0xe1, 0xe6, 0x8d, 0x13, 0xb0, 0xc4, 0x2d, 0xb9, 0x03, 0x8f, 0x05, 0xbb, 0xbc, 0x7e, 0xfa, - 0x7f, 0x18, 0xec, 0x5d, 0xd6, 0xed, 0x9c, 0x7e, 0xae, 0xa8, 0xd4, 0x6b, 0xdb, 0x0e, 0x60, 0x37, - 0xd1, 0x94, 0x96, 0xee, 0xc0, 0xb3, 0x02, 0x87, 0x37, 0x01, 0x1e, 0x81, 0x7d, 0x4b, 0xd9, 0x92, - 0x94, 0x6b, 0x79, 0x2c, 0xd8, 0x3f, 0xc5, 0xb0, 0x47, 0x36, 0x33, 0x15, 0xde, 0x2a, 0x6a, 0x6d, - 0x61, 0xb0, 0xdc, 0xa1, 0xc7, 0x82, 0xf1, 0x43, 0x6d, 0x03, 0xcc, 0x5b, 0x85, 0x7f, 0x07, 0xd0, - 0x12, 0x15, 0xb2, 0x42, 0x17, 0x46, 0x29, 0x95, 0x65, 0x8d, 0xdd, 0x20, 0x75, 0xe1, 0xf6, 0x54, - 0xfe, 0x2b, 0x18, 0x5f, 0xcb, 0x55, 0xd9, 0xad, 0xbe, 0x07, 0x4c, 0x98, 0x21, 0x16, 0x67, 0xa2, - 0x8e, 0x16, 0xe6, 0x52, 0x16, 0x67, 0x0b, 0xff, 0x25, 0x38, 0x8d, 0xb4, 0x66, 0x9a, 0x82, 0xad, - 0xa8, 0x5c, 0x49, 0xdd, 0xaa, 0xdb, 0xe8, 0xe8, 0x1d, 0xd8, 0xcd, 0x04, 0x44, 0xd8, 0x9f, 0x45, - 0xf1, 0x45, 0xc4, 0xbf, 0xdd, 0xc4, 0x1f, 0xe3, 0xcf, 0x5f, 0xe2, 0xc9, 0x0e, 0x3e, 0x81, 0x71, - 0x9b, 0xfb, 0x74, 0x76, 0x15, 0x4d, 0x18, 0x3e, 0x85, 0xc7, 0x6d, 0xe2, 0x43, 0x64, 0x52, 0x83, - 0xd3, 0xbf, 0x16, 0x8c, 0x66, 0x8a, 0x48, 0x93, 0xc2, 0xb7, 0xf0, 0x68, 0x2e, 0x2a, 0x73, 0x0a, - 0x74, 0xfb, 0x5b, 0xf4, 0xff, 0xaf, 0xc3, 0xe9, 0x9a, 0x4a, 0x21, 0x2b, 0x7f, 0x07, 0xdf, 0xc0, - 0xb0, 0x46, 0xc6, 0xe7, 0x0f, 0x6e, 0x7d, 0xbf, 0xef, 0xe1, 0xb3, 0xff, 0x0b, 0x4d, 0xe7, 0x25, - 0x60, 0x37, 0xf9, 0xec, 0x87, 0x26, 0x75, 0x41, 0x52, 0x54, 0x1b, 0x31, 0x5c, 0xc1, 0x41, 0xe7, - 0x34, 0x27, 0xf5, 0x8b, 0xd4, 0x5c, 0x2b, 0x12, 0xe9, 0x26, 0x5e, 0x27, 0xac, 0xef, 0xf6, 0x5e, - 0x26, 0x94, 0xe9, 0xcd, 0xdd, 0x02, 0x86, 0x37, 0xf0, 0xa2, 0x73, 0x3b, 0x4f, 0x96, 0x89, 0xa2, - 0xef, 0x3a, 0xc9, 0x33, 0x21, 0xb7, 0x31, 0x3d, 0x61, 0xe7, 0xce, 0xd7, 0x51, 0x78, 0x6c, 0x3e, - 0xcc, 0x85, 0x6d, 0x7e, 0x5e, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x10, 0xe0, 0x82, 0xb9, - 0x03, 0x00, 0x00, +var File_proto_helloworld_proto protoreflect.FileDescriptor + +var file_proto_helloworld_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, + 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, + 0x6f, 0x72, 0x6c, 0x64, 0x22, 0x2e, 0x0a, 0x06, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x61, 0x67, 0x65, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 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, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, + 0x2a, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x12, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x47, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x06, 0x70, + 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x68, 0x65, + 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, + 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x22, 0x68, 0x0a, 0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, + 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, + 0x6c, 0x64, 0x2e, 0x47, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x22, 0x29, 0x0a, 0x0b, 0x50, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x01, 0x61, 0x12, 0x0c, + 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x01, 0x62, 0x22, 0x23, 0x0a, 0x09, + 0x50, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x2a, 0x40, 0x0a, 0x06, 0x47, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x0e, 0x47, + 0x45, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x0f, 0x0a, 0x0b, 0x47, 0x45, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x4d, 0x41, 0x4c, 0x45, 0x10, 0x01, + 0x12, 0x11, 0x0a, 0x0d, 0x47, 0x45, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x46, 0x45, 0x4d, 0x41, 0x4c, + 0x45, 0x10, 0x02, 0x32, 0xc0, 0x03, 0x0a, 0x07, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x12, + 0x3e, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x18, 0x2e, 0x68, 0x65, + 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, + 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x38, 0x0a, 0x04, 0x50, 0x6c, 0x75, 0x73, 0x12, 0x17, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, + 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x50, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x15, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x50, 0x6c, + 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x12, 0x53, 0x61, 0x79, + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x41, 0x66, 0x74, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, + 0x18, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, + 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, + 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x14, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x68, 0x65, + 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, + 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x30, + 0x01, 0x12, 0x4c, 0x0a, 0x14, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x68, 0x65, 0x6c, 0x6c, + 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, + 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x28, 0x01, 0x12, + 0x55, 0x0a, 0x1b, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x42, 0x69, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, + 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, + 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_helloworld_proto_rawDescOnce sync.Once + file_proto_helloworld_proto_rawDescData = file_proto_helloworld_proto_rawDesc +) + +func file_proto_helloworld_proto_rawDescGZIP() []byte { + file_proto_helloworld_proto_rawDescOnce.Do(func() { + file_proto_helloworld_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_helloworld_proto_rawDescData) + }) + return file_proto_helloworld_proto_rawDescData +} + +var file_proto_helloworld_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_proto_helloworld_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_proto_helloworld_proto_goTypes = []interface{}{ + (Gender)(0), // 0: helloworld.Gender + (*Person)(nil), // 1: helloworld.Person + (*HelloRequest)(nil), // 2: helloworld.HelloRequest + (*HelloReply)(nil), // 3: helloworld.HelloReply + (*PlusRequest)(nil), // 4: helloworld.PlusRequest + (*PlusReply)(nil), // 5: helloworld.PlusReply +} +var file_proto_helloworld_proto_depIdxs = []int32{ + 0, // 0: helloworld.HelloRequest.gender:type_name -> helloworld.Gender + 1, // 1: helloworld.HelloRequest.person:type_name -> helloworld.Person + 0, // 2: helloworld.HelloReply.gender:type_name -> helloworld.Gender + 2, // 3: helloworld.Greeter.SayHello:input_type -> helloworld.HelloRequest + 4, // 4: helloworld.Greeter.Plus:input_type -> helloworld.PlusRequest + 2, // 5: helloworld.Greeter.SayHelloAfterDelay:input_type -> helloworld.HelloRequest + 2, // 6: helloworld.Greeter.SayHelloServerStream:input_type -> helloworld.HelloRequest + 2, // 7: helloworld.Greeter.SayHelloClientStream:input_type -> helloworld.HelloRequest + 2, // 8: helloworld.Greeter.SayHelloBidirectionalStream:input_type -> helloworld.HelloRequest + 3, // 9: helloworld.Greeter.SayHello:output_type -> helloworld.HelloReply + 5, // 10: helloworld.Greeter.Plus:output_type -> helloworld.PlusReply + 3, // 11: helloworld.Greeter.SayHelloAfterDelay:output_type -> helloworld.HelloReply + 3, // 12: helloworld.Greeter.SayHelloServerStream:output_type -> helloworld.HelloReply + 3, // 13: helloworld.Greeter.SayHelloClientStream:output_type -> helloworld.HelloReply + 3, // 14: helloworld.Greeter.SayHelloBidirectionalStream:output_type -> helloworld.HelloReply + 9, // [9:15] is the sub-list for method output_type + 3, // [3:9] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_proto_helloworld_proto_init() } +func file_proto_helloworld_proto_init() { + if File_proto_helloworld_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_helloworld_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Person); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_helloworld_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HelloRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_helloworld_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HelloReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_helloworld_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_helloworld_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PlusReply); 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_proto_helloworld_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_helloworld_proto_goTypes, + DependencyIndexes: file_proto_helloworld_proto_depIdxs, + EnumInfos: file_proto_helloworld_proto_enumTypes, + MessageInfos: file_proto_helloworld_proto_msgTypes, + }.Build() + File_proto_helloworld_proto = out.File + file_proto_helloworld_proto_rawDesc = nil + file_proto_helloworld_proto_goTypes = nil + file_proto_helloworld_proto_depIdxs = nil } diff --git a/proto/import.pb.go b/proto/import.pb.go new file mode 100644 index 0000000..28fabf3 --- /dev/null +++ b/proto/import.pb.go @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.6.1 +// source: proto/import.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_import_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_proto_import_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) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_proto_import_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Response struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Body string `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` +} + +func (x *Response) Reset() { + *x = Response{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_import_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_proto_import_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) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_proto_import_proto_rawDescGZIP(), []int{1} +} + +func (x *Response) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +var File_proto_import_proto protoreflect.FileDescriptor + +var file_proto_import_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x70, 0x6b, 0x67, 0x22, 0x1a, 0x0a, 0x04, 0x55, 0x73, 0x65, + 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_import_proto_rawDescOnce sync.Once + file_proto_import_proto_rawDescData = file_proto_import_proto_rawDesc +) + +func file_proto_import_proto_rawDescGZIP() []byte { + file_proto_import_proto_rawDescOnce.Do(func() { + file_proto_import_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_import_proto_rawDescData) + }) + return file_proto_import_proto_rawDescData +} + +var file_proto_import_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_proto_import_proto_goTypes = []interface{}{ + (*User)(nil), // 0: pkg.User + (*Response)(nil), // 1: pkg.Response +} +var file_proto_import_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 + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_import_proto_init() } +func file_proto_import_proto_init() { + if File_proto_import_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_import_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_import_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Response); 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_proto_import_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_proto_import_proto_goTypes, + DependencyIndexes: file_proto_import_proto_depIdxs, + MessageInfos: file_proto_import_proto_msgTypes, + }.Build() + File_proto_import_proto = out.File + file_proto_import_proto_rawDesc = nil + file_proto_import_proto_goTypes = nil + file_proto_import_proto_depIdxs = nil +} diff --git a/proto/import.proto b/proto/import.proto new file mode 100644 index 0000000..a0d527f --- /dev/null +++ b/proto/import.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package pkg; +option go_package = "./proto"; + +message User { + string name = 1; +} + +message Response { + string body = 1; +} diff --git a/proto/src.pb.go b/proto/src.pb.go new file mode 100644 index 0000000..8e6a32a --- /dev/null +++ b/proto/src.pb.go @@ -0,0 +1,162 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.6.1 +// source: proto/src.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Body string `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` +} + +func (x *Request) Reset() { + *x = Request{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_src_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Request) ProtoMessage() {} + +func (x *Request) ProtoReflect() protoreflect.Message { + mi := &file_proto_src_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) +} + +// Deprecated: Use Request.ProtoReflect.Descriptor instead. +func (*Request) Descriptor() ([]byte, []int) { + return file_proto_src_proto_rawDescGZIP(), []int{0} +} + +func (x *Request) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +func (x *Request) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +var File_proto_src_proto protoreflect.FileDescriptor + +var file_proto_src_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0a, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x1a, 0x12, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x3c, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x6b, 0x67, + 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x32, + 0x39, 0x0a, 0x0a, 0x54, 0x65, 0x73, 0x74, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x2b, 0x0a, + 0x03, 0x52, 0x75, 0x6e, 0x12, 0x13, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, + 0x64, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x70, 0x6b, 0x67, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_src_proto_rawDescOnce sync.Once + file_proto_src_proto_rawDescData = file_proto_src_proto_rawDesc +) + +func file_proto_src_proto_rawDescGZIP() []byte { + file_proto_src_proto_rawDescOnce.Do(func() { + file_proto_src_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_src_proto_rawDescData) + }) + return file_proto_src_proto_rawDescData +} + +var file_proto_src_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_proto_src_proto_goTypes = []interface{}{ + (*Request)(nil), // 0: helloworld.Request + (*User)(nil), // 1: pkg.User + (*Response)(nil), // 2: pkg.Response +} +var file_proto_src_proto_depIdxs = []int32{ + 1, // 0: helloworld.Request.user:type_name -> pkg.User + 0, // 1: helloworld.TestImport.Run:input_type -> helloworld.Request + 2, // 2: helloworld.TestImport.Run:output_type -> pkg.Response + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_proto_src_proto_init() } +func file_proto_src_proto_init() { + if File_proto_src_proto != nil { + return + } + file_proto_import_proto_init() + if !protoimpl.UnsafeEnabled { + file_proto_src_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Request); 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_proto_src_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_src_proto_goTypes, + DependencyIndexes: file_proto_src_proto_depIdxs, + MessageInfos: file_proto_src_proto_msgTypes, + }.Build() + File_proto_src_proto = out.File + file_proto_src_proto_rawDesc = nil + file_proto_src_proto_goTypes = nil + file_proto_src_proto_depIdxs = nil +} diff --git a/proto/src.proto b/proto/src.proto new file mode 100644 index 0000000..cb4a565 --- /dev/null +++ b/proto/src.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package helloworld; +option go_package = "./proto"; + +import "proto/import.proto"; + +service TestImport { + rpc Run (Request) returns (pkg.Response) {} +} + +message Request { + pkg.User user = 1; + string body = 2; +} diff --git a/proto/src_grpc.pb.go b/proto/src_grpc.pb.go new file mode 100644 index 0000000..01fe150 --- /dev/null +++ b/proto/src_grpc.pb.go @@ -0,0 +1,101 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package proto + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// TestImportClient is the client API for TestImport service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TestImportClient interface { + Run(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) +} + +type testImportClient struct { + cc grpc.ClientConnInterface +} + +func NewTestImportClient(cc grpc.ClientConnInterface) TestImportClient { + return &testImportClient{cc} +} + +func (c *testImportClient) Run(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/helloworld.TestImport/Run", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TestImportServer is the server API for TestImport service. +// All implementations must embed UnimplementedTestImportServer +// for forward compatibility +type TestImportServer interface { + Run(context.Context, *Request) (*Response, error) + mustEmbedUnimplementedTestImportServer() +} + +// UnimplementedTestImportServer must be embedded to have forward compatible implementations. +type UnimplementedTestImportServer struct { +} + +func (UnimplementedTestImportServer) Run(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Run not implemented") +} +func (UnimplementedTestImportServer) mustEmbedUnimplementedTestImportServer() {} + +// UnsafeTestImportServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TestImportServer will +// result in compilation errors. +type UnsafeTestImportServer interface { + mustEmbedUnimplementedTestImportServer() +} + +func RegisterTestImportServer(s grpc.ServiceRegistrar, srv TestImportServer) { + s.RegisterService(&TestImport_ServiceDesc, srv) +} + +func _TestImport_Run_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestImportServer).Run(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/helloworld.TestImport/Run", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestImportServer).Run(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +// TestImport_ServiceDesc is the grpc.ServiceDesc for TestImport service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TestImport_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "helloworld.TestImport", + HandlerType: (*TestImportServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Run", + Handler: _TestImport_Run_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/src.proto", +}