diff --git a/examples/addsvc/pb/addsvc.pb.go b/examples/addsvc/pb/addsvc.pb.go index 781b50b75..0e992f59d 100644 --- a/examples/addsvc/pb/addsvc.pb.go +++ b/examples/addsvc/pb/addsvc.pb.go @@ -1,27 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: addsvc.proto -/* -Package pb is a generated protocol buffer package. - -It is generated from these files: - addsvc.proto - -It has these top-level messages: - SumRequest - SumReply - ConcatRequest - ConcatReply -*/ package pb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -33,18 +20,41 @@ var _ = math.Inf // 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.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The sum request contains two parameters. type SumRequest struct { - A int64 `protobuf:"varint,1,opt,name=a" json:"a,omitempty"` - B int64 `protobuf:"varint,2,opt,name=b" json:"b,omitempty"` + 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:"-"` +} + +func (m *SumRequest) Reset() { *m = SumRequest{} } +func (m *SumRequest) String() string { return proto.CompactTextString(m) } +func (*SumRequest) ProtoMessage() {} +func (*SumRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_174367f558d60c26, []int{0} +} + +func (m *SumRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SumRequest.Unmarshal(m, b) +} +func (m *SumRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SumRequest.Marshal(b, m, deterministic) +} +func (m *SumRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SumRequest.Merge(m, src) +} +func (m *SumRequest) XXX_Size() int { + return xxx_messageInfo_SumRequest.Size(m) +} +func (m *SumRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SumRequest.DiscardUnknown(m) } -func (m *SumRequest) Reset() { *m = SumRequest{} } -func (m *SumRequest) String() string { return proto.CompactTextString(m) } -func (*SumRequest) ProtoMessage() {} -func (*SumRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_SumRequest proto.InternalMessageInfo func (m *SumRequest) GetA() int64 { if m != nil { @@ -62,14 +72,37 @@ func (m *SumRequest) GetB() int64 { // The sum response contains the result of the calculation. type SumReply struct { - V int64 `protobuf:"varint,1,opt,name=v" json:"v,omitempty"` - Err string `protobuf:"bytes,2,opt,name=err" json:"err,omitempty"` + V int64 `protobuf:"varint,1,opt,name=v,proto3" json:"v,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SumReply) Reset() { *m = SumReply{} } +func (m *SumReply) String() string { return proto.CompactTextString(m) } +func (*SumReply) ProtoMessage() {} +func (*SumReply) Descriptor() ([]byte, []int) { + return fileDescriptor_174367f558d60c26, []int{1} +} + +func (m *SumReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SumReply.Unmarshal(m, b) +} +func (m *SumReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SumReply.Marshal(b, m, deterministic) +} +func (m *SumReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_SumReply.Merge(m, src) +} +func (m *SumReply) XXX_Size() int { + return xxx_messageInfo_SumReply.Size(m) +} +func (m *SumReply) XXX_DiscardUnknown() { + xxx_messageInfo_SumReply.DiscardUnknown(m) } -func (m *SumReply) Reset() { *m = SumReply{} } -func (m *SumReply) String() string { return proto.CompactTextString(m) } -func (*SumReply) ProtoMessage() {} -func (*SumReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_SumReply proto.InternalMessageInfo func (m *SumReply) GetV() int64 { if m != nil { @@ -87,14 +120,37 @@ func (m *SumReply) GetErr() string { // The Concat request contains two parameters. type ConcatRequest struct { - A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` - B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"` + A string `protobuf:"bytes,1,opt,name=a,proto3" json:"a,omitempty"` + B string `protobuf:"bytes,2,opt,name=b,proto3" json:"b,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ConcatRequest) Reset() { *m = ConcatRequest{} } -func (m *ConcatRequest) String() string { return proto.CompactTextString(m) } -func (*ConcatRequest) ProtoMessage() {} -func (*ConcatRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *ConcatRequest) Reset() { *m = ConcatRequest{} } +func (m *ConcatRequest) String() string { return proto.CompactTextString(m) } +func (*ConcatRequest) ProtoMessage() {} +func (*ConcatRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_174367f558d60c26, []int{2} +} + +func (m *ConcatRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConcatRequest.Unmarshal(m, b) +} +func (m *ConcatRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConcatRequest.Marshal(b, m, deterministic) +} +func (m *ConcatRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConcatRequest.Merge(m, src) +} +func (m *ConcatRequest) XXX_Size() int { + return xxx_messageInfo_ConcatRequest.Size(m) +} +func (m *ConcatRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ConcatRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ConcatRequest proto.InternalMessageInfo func (m *ConcatRequest) GetA() string { if m != nil { @@ -112,14 +168,37 @@ func (m *ConcatRequest) GetB() string { // The Concat response contains the result of the concatenation. type ConcatReply struct { - V string `protobuf:"bytes,1,opt,name=v" json:"v,omitempty"` - Err string `protobuf:"bytes,2,opt,name=err" json:"err,omitempty"` + V string `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ConcatReply) Reset() { *m = ConcatReply{} } -func (m *ConcatReply) String() string { return proto.CompactTextString(m) } -func (*ConcatReply) ProtoMessage() {} -func (*ConcatReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (m *ConcatReply) Reset() { *m = ConcatReply{} } +func (m *ConcatReply) String() string { return proto.CompactTextString(m) } +func (*ConcatReply) ProtoMessage() {} +func (*ConcatReply) Descriptor() ([]byte, []int) { + return fileDescriptor_174367f558d60c26, []int{3} +} + +func (m *ConcatReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConcatReply.Unmarshal(m, b) +} +func (m *ConcatReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConcatReply.Marshal(b, m, deterministic) +} +func (m *ConcatReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConcatReply.Merge(m, src) +} +func (m *ConcatReply) XXX_Size() int { + return xxx_messageInfo_ConcatReply.Size(m) +} +func (m *ConcatReply) XXX_DiscardUnknown() { + xxx_messageInfo_ConcatReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ConcatReply proto.InternalMessageInfo func (m *ConcatReply) GetV() string { if m != nil { @@ -142,6 +221,24 @@ func init() { proto.RegisterType((*ConcatReply)(nil), "pb.ConcatReply") } +func init() { proto.RegisterFile("addsvc.proto", fileDescriptor_174367f558d60c26) } + +var fileDescriptor_174367f558d60c26 = []byte{ + // 189 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x4c, 0x49, 0x29, + 0x2e, 0x4b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0xd2, 0xe0, 0xe2, + 0x0a, 0x2e, 0xcd, 0x0d, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xe1, 0x62, 0x4c, 0x94, + 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0e, 0x62, 0x4c, 0x04, 0xf1, 0x92, 0x24, 0x98, 0x20, 0xbc, 0x24, + 0x25, 0x2d, 0x2e, 0x0e, 0xb0, 0xca, 0x82, 0x9c, 0x4a, 0x90, 0x4c, 0x19, 0x4c, 0x5d, 0x99, 0x90, + 0x00, 0x17, 0x73, 0x6a, 0x51, 0x11, 0x58, 0x25, 0x67, 0x10, 0x88, 0xa9, 0xa4, 0xcd, 0xc5, 0xeb, + 0x9c, 0x9f, 0x97, 0x9c, 0x58, 0x82, 0x61, 0x30, 0x27, 0x8a, 0xc1, 0x9c, 0x20, 0x83, 0x75, 0xb9, + 0xb8, 0x61, 0x8a, 0x51, 0xcc, 0xe6, 0xc4, 0x6a, 0xb6, 0x51, 0x0c, 0x17, 0xb3, 0x63, 0x4a, 0x8a, + 0x90, 0x2a, 0x17, 0x73, 0x70, 0x69, 0xae, 0x10, 0x9f, 0x5e, 0x41, 0x92, 0x1e, 0xc2, 0x07, 0x52, + 0x3c, 0x70, 0x7e, 0x41, 0x4e, 0xa5, 0x12, 0x83, 0x90, 0x1e, 0x17, 0x1b, 0xc4, 0x70, 0x21, 0x41, + 0x90, 0x0c, 0x8a, 0xab, 0xa4, 0xf8, 0x91, 0x85, 0xc0, 0xea, 0x93, 0xd8, 0xc0, 0x41, 0x63, 0x0c, + 0x08, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x37, 0x81, 0x99, 0x2a, 0x01, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -150,8 +247,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Add service - +// AddClient is the client API for Add service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type AddClient interface { // Sums two integers. Sum(ctx context.Context, in *SumRequest, opts ...grpc.CallOption) (*SumReply, error) @@ -169,7 +267,7 @@ func NewAddClient(cc *grpc.ClientConn) AddClient { func (c *addClient) Sum(ctx context.Context, in *SumRequest, opts ...grpc.CallOption) (*SumReply, error) { out := new(SumReply) - err := grpc.Invoke(ctx, "/pb.Add/Sum", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Add/Sum", in, out, opts...) if err != nil { return nil, err } @@ -178,15 +276,14 @@ func (c *addClient) Sum(ctx context.Context, in *SumRequest, opts ...grpc.CallOp func (c *addClient) Concat(ctx context.Context, in *ConcatRequest, opts ...grpc.CallOption) (*ConcatReply, error) { out := new(ConcatReply) - err := grpc.Invoke(ctx, "/pb.Add/Concat", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Add/Concat", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Add service - +// AddServer is the server API for Add service. type AddServer interface { // Sums two integers. Sum(context.Context, *SumRequest) (*SumReply, error) @@ -250,21 +347,3 @@ var _Add_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "addsvc.proto", } - -func init() { proto.RegisterFile("addsvc.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 189 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x4c, 0x49, 0x29, - 0x2e, 0x4b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0xd2, 0xe0, 0xe2, - 0x0a, 0x2e, 0xcd, 0x0d, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xe1, 0x62, 0x4c, 0x94, - 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0e, 0x62, 0x4c, 0x04, 0xf1, 0x92, 0x24, 0x98, 0x20, 0xbc, 0x24, - 0x25, 0x2d, 0x2e, 0x0e, 0xb0, 0xca, 0x82, 0x9c, 0x4a, 0x90, 0x4c, 0x19, 0x4c, 0x5d, 0x99, 0x90, - 0x00, 0x17, 0x73, 0x6a, 0x51, 0x11, 0x58, 0x25, 0x67, 0x10, 0x88, 0xa9, 0xa4, 0xcd, 0xc5, 0xeb, - 0x9c, 0x9f, 0x97, 0x9c, 0x58, 0x82, 0x61, 0x30, 0x27, 0x8a, 0xc1, 0x9c, 0x20, 0x83, 0x75, 0xb9, - 0xb8, 0x61, 0x8a, 0x51, 0xcc, 0xe6, 0xc4, 0x6a, 0xb6, 0x51, 0x0c, 0x17, 0xb3, 0x63, 0x4a, 0x8a, - 0x90, 0x2a, 0x17, 0x73, 0x70, 0x69, 0xae, 0x10, 0x9f, 0x5e, 0x41, 0x92, 0x1e, 0xc2, 0x07, 0x52, - 0x3c, 0x70, 0x7e, 0x41, 0x4e, 0xa5, 0x12, 0x83, 0x90, 0x1e, 0x17, 0x1b, 0xc4, 0x70, 0x21, 0x41, - 0x90, 0x0c, 0x8a, 0xab, 0xa4, 0xf8, 0x91, 0x85, 0xc0, 0xea, 0x93, 0xd8, 0xc0, 0x41, 0x63, 0x0c, - 0x08, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x37, 0x81, 0x99, 0x2a, 0x01, 0x00, 0x00, -} diff --git a/examples/addsvc/pkg/addtransport/grpc.go b/examples/addsvc/pkg/addtransport/grpc.go index ca14cce7d..fc3de9d7c 100644 --- a/examples/addsvc/pkg/addtransport/grpc.go +++ b/examples/addsvc/pkg/addtransport/grpc.go @@ -10,7 +10,6 @@ import ( stdopentracing "github.com/opentracing/opentracing-go" stdzipkin "github.com/openzipkin/zipkin-go" "github.com/sony/gobreaker" - oldcontext "golang.org/x/net/context" "golang.org/x/time/rate" "github.com/go-kit/kit/circuitbreaker" @@ -65,7 +64,7 @@ func NewGRPCServer(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zi } } -func (s *grpcServer) Sum(ctx oldcontext.Context, req *pb.SumRequest) (*pb.SumReply, error) { +func (s *grpcServer) Sum(ctx context.Context, req *pb.SumRequest) (*pb.SumReply, error) { _, rep, err := s.sum.ServeGRPC(ctx, req) if err != nil { return nil, err @@ -73,7 +72,7 @@ func (s *grpcServer) Sum(ctx oldcontext.Context, req *pb.SumRequest) (*pb.SumRep return rep.(*pb.SumReply), nil } -func (s *grpcServer) Concat(ctx oldcontext.Context, req *pb.ConcatRequest) (*pb.ConcatReply, error) { +func (s *grpcServer) Concat(ctx context.Context, req *pb.ConcatRequest) (*pb.ConcatReply, error) { _, rep, err := s.concat.ServeGRPC(ctx, req) if err != nil { return nil, err diff --git a/sd/etcd/client_test.go b/sd/etcd/client_test.go index e81922b3e..1bdb7aee9 100644 --- a/sd/etcd/client_test.go +++ b/sd/etcd/client_test.go @@ -5,8 +5,7 @@ import ( "reflect" "testing" "time" - - "golang.org/x/net/context" + "context" etcd "go.etcd.io/etcd/client" ) diff --git a/transport/grpc/_grpc_test/pb/test.pb.go b/transport/grpc/_grpc_test/pb/test.pb.go index 97d29bb1e..897674770 100644 --- a/transport/grpc/_grpc_test/pb/test.pb.go +++ b/transport/grpc/_grpc_test/pb/test.pb.go @@ -1,26 +1,14 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: test.proto -// DO NOT EDIT! -/* -Package pb is a generated protocol buffer package. - -It is generated from these files: - test.proto - -It has these top-level messages: - TestRequest - TestResponse -*/ package pb -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -32,17 +20,40 @@ var _ = math.Inf // 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.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type TestRequest struct { - A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` - B int64 `protobuf:"varint,2,opt,name=b" json:"b,omitempty"` + A string `protobuf:"bytes,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:"-"` +} + +func (m *TestRequest) Reset() { *m = TestRequest{} } +func (m *TestRequest) String() string { return proto.CompactTextString(m) } +func (*TestRequest) ProtoMessage() {} +func (*TestRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c161fcfdc0c3ff1e, []int{0} +} + +func (m *TestRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TestRequest.Unmarshal(m, b) +} +func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TestRequest.Marshal(b, m, deterministic) +} +func (m *TestRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestRequest.Merge(m, src) +} +func (m *TestRequest) XXX_Size() int { + return xxx_messageInfo_TestRequest.Size(m) +} +func (m *TestRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TestRequest.DiscardUnknown(m) } -func (m *TestRequest) Reset() { *m = TestRequest{} } -func (m *TestRequest) String() string { return proto.CompactTextString(m) } -func (*TestRequest) ProtoMessage() {} -func (*TestRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_TestRequest proto.InternalMessageInfo func (m *TestRequest) GetA() string { if m != nil { @@ -59,13 +70,36 @@ func (m *TestRequest) GetB() int64 { } type TestResponse struct { - V string `protobuf:"bytes,1,opt,name=v" json:"v,omitempty"` + V string `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *TestResponse) Reset() { *m = TestResponse{} } -func (m *TestResponse) String() string { return proto.CompactTextString(m) } -func (*TestResponse) ProtoMessage() {} -func (*TestResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *TestResponse) Reset() { *m = TestResponse{} } +func (m *TestResponse) String() string { return proto.CompactTextString(m) } +func (*TestResponse) ProtoMessage() {} +func (*TestResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c161fcfdc0c3ff1e, []int{1} +} + +func (m *TestResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TestResponse.Unmarshal(m, b) +} +func (m *TestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TestResponse.Marshal(b, m, deterministic) +} +func (m *TestResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestResponse.Merge(m, src) +} +func (m *TestResponse) XXX_Size() int { + return xxx_messageInfo_TestResponse.Size(m) +} +func (m *TestResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TestResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TestResponse proto.InternalMessageInfo func (m *TestResponse) GetV() string { if m != nil { @@ -79,6 +113,21 @@ func init() { proto.RegisterType((*TestResponse)(nil), "pb.TestResponse") } +func init() { proto.RegisterFile("test.proto", fileDescriptor_c161fcfdc0c3ff1e) } + +var fileDescriptor_c161fcfdc0c3ff1e = []byte{ + // 129 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e, + 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0xd2, 0xe4, 0xe2, 0x0e, 0x49, + 0x2d, 0x2e, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xe1, 0x62, 0x4c, 0x94, 0x60, + 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0x4c, 0x04, 0xf1, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x98, + 0x83, 0x18, 0x93, 0x94, 0x64, 0xb8, 0x78, 0x20, 0x4a, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x41, + 0xb2, 0x65, 0x30, 0xb5, 0x65, 0x46, 0xc6, 0x5c, 0x2c, 0x20, 0x59, 0x21, 0x6d, 0x28, 0xcd, 0xaf, + 0x57, 0x90, 0xa4, 0x87, 0x64, 0xb4, 0x94, 0x00, 0x42, 0x00, 0x62, 0x80, 0x12, 0x43, 0x12, 0x1b, + 0xd8, 0x21, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0xfc, 0xd8, 0xf1, 0x96, 0x00, 0x00, + 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -87,8 +136,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Test service - +// TestClient is the client API for Test service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type TestClient interface { Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) } @@ -103,15 +153,14 @@ func NewTestClient(cc *grpc.ClientConn) TestClient { func (c *testClient) Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) { out := new(TestResponse) - err := grpc.Invoke(ctx, "/pb.Test/Test", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/pb.Test/Test", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Test service - +// TestServer is the server API for Test service. type TestServer interface { Test(context.Context, *TestRequest) (*TestResponse, error) } @@ -150,18 +199,3 @@ var _Test_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "test.proto", } - -func init() { proto.RegisterFile("test.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 129 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e, - 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0xd2, 0xe4, 0xe2, 0x0e, 0x49, - 0x2d, 0x2e, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xe1, 0x62, 0x4c, 0x94, 0x60, - 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0x4c, 0x04, 0xf1, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x98, - 0x83, 0x18, 0x93, 0x94, 0x64, 0xb8, 0x78, 0x20, 0x4a, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x41, - 0xb2, 0x65, 0x30, 0xb5, 0x65, 0x46, 0xc6, 0x5c, 0x2c, 0x20, 0x59, 0x21, 0x6d, 0x28, 0xcd, 0xaf, - 0x57, 0x90, 0xa4, 0x87, 0x64, 0xb4, 0x94, 0x00, 0x42, 0x00, 0x62, 0x80, 0x12, 0x43, 0x12, 0x1b, - 0xd8, 0x21, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0xfc, 0xd8, 0xf1, 0x96, 0x00, 0x00, - 0x00, -} diff --git a/transport/grpc/_grpc_test/server.go b/transport/grpc/_grpc_test/server.go index 49e70a91f..26cbf343e 100644 --- a/transport/grpc/_grpc_test/server.go +++ b/transport/grpc/_grpc_test/server.go @@ -4,8 +4,6 @@ import ( "context" "fmt" - oldcontext "golang.org/x/net/context" - "github.com/go-kit/kit/endpoint" grpctransport "github.com/go-kit/kit/transport/grpc" "github.com/go-kit/kit/transport/grpc/_grpc_test/pb" @@ -36,7 +34,7 @@ type serverBinding struct { test grpctransport.Handler } -func (b *serverBinding) Test(ctx oldcontext.Context, req *pb.TestRequest) (*pb.TestResponse, error) { +func (b *serverBinding) Test(ctx context.Context, req *pb.TestRequest) (*pb.TestResponse, error) { _, response, err := b.test.ServeGRPC(ctx, req) if err != nil { return nil, err diff --git a/transport/grpc/server.go b/transport/grpc/server.go index df88bf980..7e66c9cc0 100644 --- a/transport/grpc/server.go +++ b/transport/grpc/server.go @@ -3,7 +3,6 @@ package grpc import ( "context" - oldcontext "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -15,7 +14,7 @@ import ( // implementation. The incoming request parameter, and returned response // parameter, are both gRPC types, not user-domain. type Handler interface { - ServeGRPC(ctx oldcontext.Context, request interface{}) (oldcontext.Context, interface{}, error) + ServeGRPC(ctx context.Context, request interface{}) (context.Context, interface{}, error) } // Server wraps an endpoint and implements grpc.Handler. @@ -80,7 +79,7 @@ func ServerFinalizer(f ...ServerFinalizerFunc) ServerOption { } // ServeGRPC implements the Handler interface. -func (s Server) ServeGRPC(ctx oldcontext.Context, req interface{}) (retctx oldcontext.Context, resp interface{}, err error) { +func (s Server) ServeGRPC(ctx context.Context, req interface{}) (retctx context.Context, resp interface{}, err error) { // Retrieve gRPC metadata. md, ok := metadata.FromIncomingContext(ctx) if !ok {