diff --git a/auth/auth.go b/auth/auth.go index a35c95fac..a7e2890ee 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -4,8 +4,9 @@ package grpc_auth import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/auth/auth_test.go b/auth/auth_test.go index 6ca7683f6..50bb9b3b8 100644 --- a/auth/auth_test.go +++ b/auth/auth_test.go @@ -4,13 +4,9 @@ package grpc_auth_test import ( - "testing" - - "github.com/stretchr/testify/suite" - "google.golang.org/grpc" - + "context" "fmt" - + "testing" "time" "github.com/grpc-ecosystem/go-grpc-middleware/auth" @@ -19,8 +15,9 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/net/context" + "github.com/stretchr/testify/suite" "golang.org/x/oauth2" + "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials/oauth" "google.golang.org/grpc/metadata" diff --git a/auth/examples_test.go b/auth/examples_test.go index 916daa931..cc2db2536 100644 --- a/auth/examples_test.go +++ b/auth/examples_test.go @@ -1,9 +1,10 @@ package grpc_auth_test import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/auth" "github.com/grpc-ecosystem/go-grpc-middleware/tags" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/auth/metadata.go b/auth/metadata.go index 500206533..6ac79f6e0 100644 --- a/auth/metadata.go +++ b/auth/metadata.go @@ -4,10 +4,10 @@ package grpc_auth import ( + "context" "strings" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/auth/metadata_test.go b/auth/metadata_test.go index 16f7ded40..314a6bc46 100644 --- a/auth/metadata_test.go +++ b/auth/metadata_test.go @@ -4,11 +4,11 @@ package grpc_auth import ( + "context" "testing" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" "github.com/stretchr/testify/assert" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" diff --git a/chain.go b/chain.go index 45a2f5f49..5f701de3b 100644 --- a/chain.go +++ b/chain.go @@ -6,7 +6,8 @@ package grpc_middleware import ( - "golang.org/x/net/context" + "context" + "google.golang.org/grpc" ) diff --git a/chain_test.go b/chain_test.go index 60008a1cd..1a0bfc4f5 100644 --- a/chain_test.go +++ b/chain_test.go @@ -4,11 +4,11 @@ package grpc_middleware import ( + "context" "fmt" "testing" "github.com/stretchr/testify/require" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) diff --git a/logging/common.go b/logging/common.go index f725d038a..208d89bbf 100644 --- a/logging/common.go +++ b/logging/common.go @@ -4,7 +4,8 @@ package grpc_logging import ( - "golang.org/x/net/context" + "context" + "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/logging/logrus/client_interceptors.go b/logging/logrus/client_interceptors.go index f7655ff64..840e67c0e 100644 --- a/logging/logrus/client_interceptors.go +++ b/logging/logrus/client_interceptors.go @@ -4,11 +4,11 @@ package grpc_logrus import ( + "context" "path" "time" "github.com/sirupsen/logrus" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/logrus/context.go b/logging/logrus/context.go index a39bb7720..aa0acad8d 100644 --- a/logging/logrus/context.go +++ b/logging/logrus/context.go @@ -1,9 +1,10 @@ package grpc_logrus import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" "github.com/sirupsen/logrus" - "golang.org/x/net/context" ) // AddFields adds logrus fields to the logger. diff --git a/logging/logrus/ctxlogrus/context.go b/logging/logrus/ctxlogrus/context.go index ff3e3353d..808121958 100644 --- a/logging/logrus/ctxlogrus/context.go +++ b/logging/logrus/ctxlogrus/context.go @@ -1,9 +1,10 @@ package ctxlogrus import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/tags" "github.com/sirupsen/logrus" - "golang.org/x/net/context" ) type ctxLoggerMarker struct{} diff --git a/logging/logrus/ctxlogrus/examples_test.go b/logging/logrus/ctxlogrus/examples_test.go index ac61b9df0..22d131ca9 100644 --- a/logging/logrus/ctxlogrus/examples_test.go +++ b/logging/logrus/ctxlogrus/examples_test.go @@ -1,10 +1,11 @@ package ctxlogrus_test import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" "github.com/grpc-ecosystem/go-grpc-middleware/tags" "github.com/sirupsen/logrus" - "golang.org/x/net/context" ) var logrusLogger *logrus.Logger diff --git a/logging/logrus/examples_test.go b/logging/logrus/examples_test.go index e0f9e1af2..2f228e667 100644 --- a/logging/logrus/examples_test.go +++ b/logging/logrus/examples_test.go @@ -1,6 +1,7 @@ package grpc_logrus_test import ( + "context" "time" "github.com/grpc-ecosystem/go-grpc-middleware" @@ -9,7 +10,6 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/tags/logrus" pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto" "github.com/sirupsen/logrus" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/logrus/options_test.go b/logging/logrus/options_test.go index 815fe3304..8df3489e4 100644 --- a/logging/logrus/options_test.go +++ b/logging/logrus/options_test.go @@ -1,9 +1,10 @@ package grpc_logrus import ( - "github.com/stretchr/testify/assert" "testing" "time" + + "github.com/stretchr/testify/assert" ) func TestDurationToTimeMillisField(t *testing.T) { diff --git a/logging/logrus/payload_interceptors.go b/logging/logrus/payload_interceptors.go index c0aebc8a7..9f2a2f951 100644 --- a/logging/logrus/payload_interceptors.go +++ b/logging/logrus/payload_interceptors.go @@ -2,6 +2,7 @@ package grpc_logrus import ( "bytes" + "context" "fmt" "github.com/golang/protobuf/jsonpb" @@ -9,7 +10,6 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/logging" "github.com/grpc-ecosystem/go-grpc-middleware/tags/logrus" "github.com/sirupsen/logrus" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/logrus/payload_interceptors_test.go b/logging/logrus/payload_interceptors_test.go index 78ee395f6..342a1e5fb 100644 --- a/logging/logrus/payload_interceptors_test.go +++ b/logging/logrus/payload_interceptors_test.go @@ -1,6 +1,7 @@ package grpc_logrus_test import ( + "context" "io" "io/ioutil" "runtime" @@ -15,7 +16,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/logrus/server_interceptors.go b/logging/logrus/server_interceptors.go index c3b2c7515..6b900442a 100644 --- a/logging/logrus/server_interceptors.go +++ b/logging/logrus/server_interceptors.go @@ -3,6 +3,7 @@ package grpc_logrus import ( + "context" "path" "time" @@ -10,7 +11,6 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" "github.com/grpc-ecosystem/go-grpc-middleware/tags/logrus" "github.com/sirupsen/logrus" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/logrus/shared_test.go b/logging/logrus/shared_test.go index 63f369744..309ce354a 100644 --- a/logging/logrus/shared_test.go +++ b/logging/logrus/shared_test.go @@ -2,6 +2,7 @@ package grpc_logrus_test import ( "bytes" + "context" "encoding/json" "io" "testing" @@ -12,7 +13,6 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/testing" pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto" "github.com/sirupsen/logrus" - "golang.org/x/net/context" "google.golang.org/grpc/codes" ) diff --git a/logging/zap/client_interceptors.go b/logging/zap/client_interceptors.go index 2f7a6a0c6..a5b76a8bd 100644 --- a/logging/zap/client_interceptors.go +++ b/logging/zap/client_interceptors.go @@ -4,12 +4,12 @@ package grpc_zap import ( + "context" "path" "time" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/zap/context.go b/logging/zap/context.go index cce9903a1..56f6408a6 100644 --- a/logging/zap/context.go +++ b/logging/zap/context.go @@ -1,10 +1,11 @@ package grpc_zap import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/net/context" ) // AddFields adds zap fields to the logger. diff --git a/logging/zap/ctxzap/context.go b/logging/zap/ctxzap/context.go index d38dbfda0..3ca633df2 100644 --- a/logging/zap/ctxzap/context.go +++ b/logging/zap/ctxzap/context.go @@ -1,10 +1,11 @@ package ctxzap import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/tags" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/net/context" ) type ctxMarker struct{} diff --git a/logging/zap/options_test.go b/logging/zap/options_test.go index 5121f1864..3b4cd61e2 100644 --- a/logging/zap/options_test.go +++ b/logging/zap/options_test.go @@ -1,11 +1,12 @@ package grpc_zap import ( - "github.com/stretchr/testify/assert" - "go.uber.org/zap/zapcore" "math" "testing" "time" + + "github.com/stretchr/testify/assert" + "go.uber.org/zap/zapcore" ) func TestDurationToTimeMillisField(t *testing.T) { diff --git a/logging/zap/payload_interceptors.go b/logging/zap/payload_interceptors.go index 293cdf9a6..c47a011ef 100644 --- a/logging/zap/payload_interceptors.go +++ b/logging/zap/payload_interceptors.go @@ -2,6 +2,7 @@ package grpc_zap import ( "bytes" + "context" "fmt" "github.com/golang/protobuf/jsonpb" @@ -10,7 +11,6 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/zap/payload_interceptors_test.go b/logging/zap/payload_interceptors_test.go index 312e1692d..88eb07716 100644 --- a/logging/zap/payload_interceptors_test.go +++ b/logging/zap/payload_interceptors_test.go @@ -1,22 +1,20 @@ package grpc_zap_test import ( + "context" + "io" "runtime" - "testing" - "strings" + "testing" "github.com/stretchr/testify/suite" "google.golang.org/grpc" - "io" - "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/go-grpc-middleware/tags" pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/net/context" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" "go.uber.org/zap" diff --git a/logging/zap/server_interceptors.go b/logging/zap/server_interceptors.go index b0eeb9729..1a28a8056 100644 --- a/logging/zap/server_interceptors.go +++ b/logging/zap/server_interceptors.go @@ -1,6 +1,7 @@ package grpc_zap import ( + "context" "path" "time" @@ -9,7 +10,6 @@ import ( "github.com/grpc-ecosystem/go-grpc-middleware/tags/zap" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/logging/zap/shared_test.go b/logging/zap/shared_test.go index f9d8a49b0..59e9baf61 100644 --- a/logging/zap/shared_test.go +++ b/logging/zap/shared_test.go @@ -2,6 +2,7 @@ package grpc_zap_test import ( "bytes" + "context" "encoding/json" "io" "testing" @@ -12,7 +13,6 @@ import ( pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/net/context" ) var ( diff --git a/makefile b/makefile index 51dc5b8f2..b18d2d2bb 100644 --- a/makefile +++ b/makefile @@ -8,7 +8,8 @@ fmt: go fmt $(GOFILES_NOVENDOR) vet: - go vet $(GOFILES_NOVENDOR) + # do not check lostcancel, they are intentional. + go vet -lostcancel=false $(GOFILES_NOVENDOR) test: vet ./scripts/test_all.sh diff --git a/recovery/interceptors.go b/recovery/interceptors.go index f687e2ba8..d9794c3e7 100644 --- a/recovery/interceptors.go +++ b/recovery/interceptors.go @@ -4,7 +4,8 @@ package grpc_recovery import ( - "golang.org/x/net/context" + "context" + "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/recovery/interceptors_test.go b/recovery/interceptors_test.go index e8547f4ba..cc6c8d1e9 100644 --- a/recovery/interceptors_test.go +++ b/recovery/interceptors_test.go @@ -4,6 +4,7 @@ package grpc_recovery_test import ( + "context" "testing" "github.com/grpc-ecosystem/go-grpc-middleware" @@ -13,7 +14,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/recovery/options.go b/recovery/options.go index 07bacda3a..ffe9c64c7 100644 --- a/recovery/options.go +++ b/recovery/options.go @@ -3,7 +3,7 @@ package grpc_recovery -import "golang.org/x/net/context" +import "context" var ( defaultOptions = &options{ diff --git a/retry/examples_test.go b/retry/examples_test.go index 6b136a4bc..591ee6459 100644 --- a/retry/examples_test.go +++ b/retry/examples_test.go @@ -4,13 +4,13 @@ package grpc_retry_test import ( + "context" "fmt" "io" "time" "github.com/grpc-ecosystem/go-grpc-middleware/retry" pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/retry/options.go b/retry/options.go index 71a03caa3..a255ba7e9 100644 --- a/retry/options.go +++ b/retry/options.go @@ -4,9 +4,9 @@ package grpc_retry import ( + "context" "time" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/retry/retry.go b/retry/retry.go index bf098582f..b39a50a59 100644 --- a/retry/retry.go +++ b/retry/retry.go @@ -4,13 +4,13 @@ package grpc_retry import ( + "context" "fmt" "io" "sync" "time" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" - "golang.org/x/net/context" "golang.org/x/net/trace" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/retry/retry_test.go b/retry/retry_test.go index ee5557f60..d7cd32c4f 100644 --- a/retry/retry_test.go +++ b/retry/retry_test.go @@ -4,6 +4,7 @@ package grpc_retry_test import ( + "context" "io" "sync" "testing" @@ -18,7 +19,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/tags/interceptors.go b/tags/interceptors.go index 038afd26b..4c66a8df7 100644 --- a/tags/interceptors.go +++ b/tags/interceptors.go @@ -4,8 +4,9 @@ package grpc_ctxtags import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/peer" ) diff --git a/tags/interceptors_test.go b/tags/interceptors_test.go index 0b1b64bbe..70e7ea8ab 100644 --- a/tags/interceptors_test.go +++ b/tags/interceptors_test.go @@ -1,10 +1,10 @@ package grpc_ctxtags_test import ( + "context" "encoding/json" "io" "testing" - "time" "github.com/grpc-ecosystem/go-grpc-middleware/tags" @@ -13,7 +13,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "golang.org/x/net/context" "google.golang.org/grpc" ) diff --git a/tags/logrus/context.go b/tags/logrus/context.go index 2596be89f..df55be96c 100644 --- a/tags/logrus/context.go +++ b/tags/logrus/context.go @@ -1,9 +1,10 @@ package ctx_logrus import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" "github.com/sirupsen/logrus" - "golang.org/x/net/context" ) // AddFields adds logrus fields to the logger. diff --git a/tags/zap/context.go b/tags/zap/context.go index be608ec91..d431ca81e 100644 --- a/tags/zap/context.go +++ b/tags/zap/context.go @@ -1,10 +1,11 @@ package ctx_zap import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/net/context" ) // AddFields adds zap fields to the logger. diff --git a/testing/interceptor_suite.go b/testing/interceptor_suite.go index 6f2f52d34..6658ea3cb 100644 --- a/testing/interceptor_suite.go +++ b/testing/interceptor_suite.go @@ -4,17 +4,16 @@ package grpc_testing import ( - "net" - "time" - + "context" "flag" + "net" "path" "runtime" + "time" pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) diff --git a/testing/pingservice.go b/testing/pingservice.go index 2dc2dbd35..04fd7fc1f 100644 --- a/testing/pingservice.go +++ b/testing/pingservice.go @@ -8,12 +8,12 @@ Package `grpc_testing` provides helper functions for testing validators in this package grpc_testing import ( + "context" "io" "testing" pb_testproto "github.com/grpc-ecosystem/go-grpc-middleware/testing/testproto" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/testing/testproto/test.pb.go b/testing/testproto/test.pb.go index 437f8d444..9e5097944 100644 --- a/testing/testproto/test.pb.go +++ b/testing/testproto/test.pb.go @@ -1,27 +1,16 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: test.proto -// DO NOT EDIT! -/* -Package mwitkow_testproto is a generated protocol buffer package. - -It is generated from these files: - test.proto - -It has these top-level messages: - Empty - PingRequest - PingResponse -*/ package mwitkow_testproto -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" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -33,26 +22,72 @@ 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 Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_c161fcfdc0c3ff1e, []int{0} +} + +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (m *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(m, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) } -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_Empty proto.InternalMessageInfo type PingRequest struct { - Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` - SleepTimeMs int32 `protobuf:"varint,2,opt,name=sleep_time_ms,json=sleepTimeMs" json:"sleep_time_ms,omitempty"` - ErrorCodeReturned uint32 `protobuf:"varint,3,opt,name=error_code_returned,json=errorCodeReturned" json:"error_code_returned,omitempty"` + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + SleepTimeMs int32 `protobuf:"varint,2,opt,name=sleep_time_ms,json=sleepTimeMs,proto3" json:"sleep_time_ms,omitempty"` + ErrorCodeReturned uint32 `protobuf:"varint,3,opt,name=error_code_returned,json=errorCodeReturned,proto3" json:"error_code_returned,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PingRequest) Reset() { *m = PingRequest{} } -func (m *PingRequest) String() string { return proto.CompactTextString(m) } -func (*PingRequest) ProtoMessage() {} -func (*PingRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *PingRequest) Reset() { *m = PingRequest{} } +func (m *PingRequest) String() string { return proto.CompactTextString(m) } +func (*PingRequest) ProtoMessage() {} +func (*PingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c161fcfdc0c3ff1e, []int{1} +} + +func (m *PingRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PingRequest.Unmarshal(m, b) +} +func (m *PingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PingRequest.Marshal(b, m, deterministic) +} +func (m *PingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingRequest.Merge(m, src) +} +func (m *PingRequest) XXX_Size() int { + return xxx_messageInfo_PingRequest.Size(m) +} +func (m *PingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PingRequest proto.InternalMessageInfo func (m *PingRequest) GetValue() string { if m != nil { @@ -76,14 +111,37 @@ func (m *PingRequest) GetErrorCodeReturned() uint32 { } type PingResponse struct { - Value string `protobuf:"bytes,1,opt,name=Value,json=value" json:"Value,omitempty"` - Counter int32 `protobuf:"varint,2,opt,name=counter" json:"counter,omitempty"` + Value string `protobuf:"bytes,1,opt,name=Value,proto3" json:"Value,omitempty"` + Counter int32 `protobuf:"varint,2,opt,name=counter,proto3" json:"counter,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PingResponse) Reset() { *m = PingResponse{} } -func (m *PingResponse) String() string { return proto.CompactTextString(m) } -func (*PingResponse) ProtoMessage() {} -func (*PingResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *PingResponse) Reset() { *m = PingResponse{} } +func (m *PingResponse) String() string { return proto.CompactTextString(m) } +func (*PingResponse) ProtoMessage() {} +func (*PingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c161fcfdc0c3ff1e, []int{2} +} + +func (m *PingResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PingResponse.Unmarshal(m, b) +} +func (m *PingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PingResponse.Marshal(b, m, deterministic) +} +func (m *PingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingResponse.Merge(m, src) +} +func (m *PingResponse) XXX_Size() int { + return xxx_messageInfo_PingResponse.Size(m) +} +func (m *PingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PingResponse proto.InternalMessageInfo func (m *PingResponse) GetValue() string { if m != nil { @@ -105,6 +163,31 @@ func init() { proto.RegisterType((*PingResponse)(nil), "mwitkow.testproto.PingResponse") } +func init() { proto.RegisterFile("test.proto", fileDescriptor_c161fcfdc0c3ff1e) } + +var fileDescriptor_c161fcfdc0c3ff1e = []byte{ + // 289 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x50, 0x4f, 0x4b, 0xfb, 0x40, + 0x10, 0xed, 0xfe, 0xfa, 0x8b, 0xb5, 0x13, 0x7b, 0xe8, 0xea, 0x21, 0x78, 0xd0, 0xb0, 0xa7, 0x9c, + 0x42, 0xd1, 0xbb, 0x17, 0x11, 0x15, 0x14, 0x25, 0x29, 0x5e, 0x43, 0x4d, 0x06, 0x59, 0xec, 0x66, + 0xe3, 0xee, 0xa4, 0xc1, 0x8f, 0xe1, 0x37, 0x96, 0xdd, 0x46, 0x28, 0x68, 0xd1, 0x43, 0x8f, 0xef, + 0xbd, 0xe1, 0xfd, 0x19, 0x00, 0x42, 0x4b, 0x69, 0x63, 0x34, 0x69, 0x3e, 0x55, 0x9d, 0xa4, 0x57, + 0xdd, 0xa5, 0x8e, 0xf3, 0x94, 0x18, 0x41, 0x70, 0xa5, 0x1a, 0x7a, 0x17, 0x1d, 0x84, 0x8f, 0xb2, + 0x7e, 0xc9, 0xf0, 0xad, 0x45, 0x4b, 0xfc, 0x08, 0x82, 0xd5, 0x62, 0xd9, 0x62, 0xc4, 0x62, 0x96, + 0x8c, 0xb3, 0x35, 0xe0, 0x02, 0x26, 0x76, 0x89, 0xd8, 0x14, 0x24, 0x15, 0x16, 0xca, 0x46, 0xff, + 0x62, 0x96, 0x04, 0x59, 0xe8, 0xc9, 0xb9, 0x54, 0x78, 0x6f, 0x79, 0x0a, 0x87, 0x68, 0x8c, 0x36, + 0x45, 0xa9, 0x2b, 0x2c, 0x0c, 0x52, 0x6b, 0x6a, 0xac, 0xa2, 0x61, 0xcc, 0x92, 0x49, 0x36, 0xf5, + 0xd2, 0xa5, 0xae, 0x30, 0xeb, 0x05, 0x71, 0x01, 0x07, 0xeb, 0x60, 0xdb, 0xe8, 0xda, 0xa2, 0x4b, + 0x7e, 0xda, 0x4c, 0xf6, 0x80, 0x47, 0x30, 0x2a, 0x75, 0x5b, 0x13, 0x9a, 0x3e, 0xf3, 0x0b, 0x9e, + 0x7d, 0x0c, 0x21, 0x9c, 0xa3, 0xa5, 0x1c, 0xcd, 0x4a, 0x96, 0xc8, 0x6f, 0x60, 0xec, 0xfc, 0xfc, + 0x2a, 0x1e, 0xa5, 0xdf, 0x26, 0xa7, 0x5e, 0x39, 0x3e, 0xfd, 0x41, 0xd9, 0xec, 0x21, 0x06, 0xfc, + 0x16, 0xfe, 0x3b, 0x86, 0x9f, 0x6c, 0x3d, 0xf5, 0xbf, 0xfa, 0x8b, 0xd5, 0x75, 0x5f, 0xca, 0xad, + 0xff, 0xd5, 0x6f, 0x6b, 0x69, 0x31, 0xe0, 0x0f, 0xb0, 0xef, 0x4e, 0xef, 0xa4, 0xa5, 0x1d, 0xf4, + 0x9a, 0x31, 0x9e, 0x03, 0x38, 0x2e, 0x27, 0x83, 0x0b, 0xb5, 0x03, 0xcb, 0x84, 0xcd, 0xd8, 0xf3, + 0x9e, 0x57, 0xce, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x75, 0xf0, 0x5c, 0x7d, 0x02, 0x00, + 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -113,8 +196,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for TestService service - +// TestServiceClient is the client API for TestService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type TestServiceClient interface { PingEmpty(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PingResponse, error) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) @@ -133,7 +217,7 @@ func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient { func (c *testServiceClient) PingEmpty(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PingResponse, error) { out := new(PingResponse) - err := grpc.Invoke(ctx, "/mwitkow.testproto.TestService/PingEmpty", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/mwitkow.testproto.TestService/PingEmpty", in, out, opts...) if err != nil { return nil, err } @@ -142,7 +226,7 @@ func (c *testServiceClient) PingEmpty(ctx context.Context, in *Empty, opts ...gr func (c *testServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { out := new(PingResponse) - err := grpc.Invoke(ctx, "/mwitkow.testproto.TestService/Ping", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/mwitkow.testproto.TestService/Ping", in, out, opts...) if err != nil { return nil, err } @@ -151,7 +235,7 @@ func (c *testServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...g func (c *testServiceClient) PingError(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := grpc.Invoke(ctx, "/mwitkow.testproto.TestService/PingError", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/mwitkow.testproto.TestService/PingError", in, out, opts...) if err != nil { return nil, err } @@ -159,7 +243,7 @@ func (c *testServiceClient) PingError(ctx context.Context, in *PingRequest, opts } func (c *testServiceClient) PingList(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (TestService_PingListClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/mwitkow.testproto.TestService/PingList", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/mwitkow.testproto.TestService/PingList", opts...) if err != nil { return nil, err } @@ -191,7 +275,7 @@ func (x *testServicePingListClient) Recv() (*PingResponse, error) { } func (c *testServiceClient) PingStream(ctx context.Context, opts ...grpc.CallOption) (TestService_PingStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[1], c.cc, "/mwitkow.testproto.TestService/PingStream", opts...) + stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/mwitkow.testproto.TestService/PingStream", opts...) if err != nil { return nil, err } @@ -221,8 +305,7 @@ func (x *testServicePingStreamClient) Recv() (*PingResponse, error) { return m, nil } -// Server API for TestService service - +// TestServiceServer is the server API for TestService service. type TestServiceServer interface { PingEmpty(context.Context, *Empty) (*PingResponse, error) Ping(context.Context, *PingRequest) (*PingResponse, error) @@ -231,6 +314,26 @@ type TestServiceServer interface { PingStream(TestService_PingStreamServer) error } +// UnimplementedTestServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTestServiceServer struct { +} + +func (*UnimplementedTestServiceServer) PingEmpty(ctx context.Context, req *Empty) (*PingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PingEmpty not implemented") +} +func (*UnimplementedTestServiceServer) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (*UnimplementedTestServiceServer) PingError(ctx context.Context, req *PingRequest) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method PingError not implemented") +} +func (*UnimplementedTestServiceServer) PingList(req *PingRequest, srv TestService_PingListServer) error { + return status.Errorf(codes.Unimplemented, "method PingList not implemented") +} +func (*UnimplementedTestServiceServer) PingStream(srv TestService_PingStreamServer) error { + return status.Errorf(codes.Unimplemented, "method PingStream not implemented") +} + func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { s.RegisterService(&_TestService_serviceDesc, srv) } @@ -368,27 +471,3 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "test.proto", } - -func init() { proto.RegisterFile("test.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 288 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x90, 0x4f, 0x4b, 0xfb, 0x30, - 0x18, 0xc7, 0x97, 0xdf, 0x7e, 0x75, 0xee, 0xa9, 0x3b, 0x2c, 0x7a, 0x28, 0x1e, 0xb4, 0xe4, 0xd4, - 0x53, 0x19, 0x7a, 0xf7, 0x22, 0xa2, 0x82, 0xa2, 0xb4, 0xc3, 0x6b, 0x99, 0xed, 0x83, 0x04, 0x97, - 0xa6, 0x26, 0x4f, 0x57, 0x7c, 0x19, 0xbe, 0x63, 0x49, 0x56, 0x41, 0x98, 0x43, 0x0f, 0x3b, 0xe6, - 0xfb, 0x79, 0xf8, 0xfe, 0x09, 0x00, 0xa1, 0xa5, 0xb4, 0x31, 0x9a, 0x34, 0x9f, 0xaa, 0x4e, 0xd2, - 0xab, 0xee, 0x52, 0xa7, 0x79, 0x49, 0x8c, 0x20, 0xb8, 0x52, 0x0d, 0xbd, 0x8b, 0x0e, 0xc2, 0x47, - 0x59, 0xbf, 0x64, 0xf8, 0xd6, 0xa2, 0x25, 0x7e, 0x04, 0xc1, 0x6a, 0xb1, 0x6c, 0x31, 0x62, 0x31, - 0x4b, 0xc6, 0xd9, 0xfa, 0xc1, 0x05, 0x4c, 0xec, 0x12, 0xb1, 0x29, 0x48, 0x2a, 0x2c, 0x94, 0x8d, - 0xfe, 0xc5, 0x2c, 0x09, 0xb2, 0xd0, 0x8b, 0x73, 0xa9, 0xf0, 0xde, 0xf2, 0x14, 0x0e, 0xd1, 0x18, - 0x6d, 0x8a, 0x52, 0x57, 0x58, 0x18, 0xa4, 0xd6, 0xd4, 0x58, 0x45, 0xc3, 0x98, 0x25, 0x93, 0x6c, - 0xea, 0xd1, 0xa5, 0xae, 0x30, 0xeb, 0x81, 0xb8, 0x80, 0x83, 0x75, 0xb0, 0x6d, 0x74, 0x6d, 0xd1, - 0x25, 0x3f, 0x6d, 0x26, 0x47, 0x30, 0x2a, 0x75, 0x5b, 0x13, 0x9a, 0x3e, 0xf3, 0xeb, 0x79, 0xf6, - 0x31, 0x84, 0x70, 0x8e, 0x96, 0x72, 0x34, 0x2b, 0x59, 0x22, 0xbf, 0x81, 0xb1, 0xf3, 0xf3, 0xab, - 0x78, 0x94, 0x6e, 0x4c, 0x4e, 0x3d, 0x39, 0x3e, 0xfd, 0x81, 0x7c, 0xef, 0x21, 0x06, 0xfc, 0x16, - 0xfe, 0x3b, 0x85, 0x9f, 0x6c, 0x3d, 0xf5, 0x7f, 0xf5, 0x17, 0xab, 0xeb, 0xbe, 0x94, 0x5b, 0xff, - 0xab, 0xdf, 0xd6, 0xd2, 0x62, 0xc0, 0x1f, 0x60, 0xdf, 0x9d, 0xde, 0x49, 0x4b, 0x3b, 0xe8, 0x35, - 0x63, 0x3c, 0x07, 0x70, 0x5a, 0x4e, 0x06, 0x17, 0x6a, 0x07, 0x96, 0x09, 0x9b, 0xb1, 0xe7, 0x3d, - 0x4f, 0xce, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x2a, 0x8a, 0x7b, 0x7d, 0x02, 0x00, 0x00, -} diff --git a/tracing/opentracing/client_interceptors.go b/tracing/opentracing/client_interceptors.go index f8fdecf5a..2a233257a 100644 --- a/tracing/opentracing/client_interceptors.go +++ b/tracing/opentracing/client_interceptors.go @@ -4,6 +4,7 @@ package grpc_opentracing import ( + "context" "io" "sync" @@ -11,7 +12,6 @@ import ( opentracing "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/opentracing/opentracing-go/log" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/metadata" diff --git a/tracing/opentracing/interceptors_test.go b/tracing/opentracing/interceptors_test.go index fec8b0661..79f7eae69 100644 --- a/tracing/opentracing/interceptors_test.go +++ b/tracing/opentracing/interceptors_test.go @@ -4,16 +4,15 @@ package grpc_opentracing_test import ( + "context" "errors" + "fmt" + "io" + "net/http" "strconv" "strings" "testing" - "fmt" - "net/http" - - "io" - "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/go-grpc-middleware/tags" "github.com/grpc-ecosystem/go-grpc-middleware/testing" @@ -24,7 +23,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/tracing/opentracing/metadata.go b/tracing/opentracing/metadata.go index 38f251d31..1af798a96 100644 --- a/tracing/opentracing/metadata.go +++ b/tracing/opentracing/metadata.go @@ -5,9 +5,8 @@ package grpc_opentracing import ( "encoding/base64" - "strings" - "fmt" + "strings" "google.golang.org/grpc/metadata" ) diff --git a/tracing/opentracing/server_interceptors.go b/tracing/opentracing/server_interceptors.go index 53764a083..5d068813b 100644 --- a/tracing/opentracing/server_interceptors.go +++ b/tracing/opentracing/server_interceptors.go @@ -4,13 +4,14 @@ package grpc_opentracing import ( + "context" + "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/go-grpc-middleware/tags" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/opentracing/opentracing-go/log" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" ) diff --git a/util/metautils/nicemd.go b/util/metautils/nicemd.go index a277bee3f..7b7e9a157 100644 --- a/util/metautils/nicemd.go +++ b/util/metautils/nicemd.go @@ -4,9 +4,9 @@ package metautils import ( + "context" "strings" - "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) diff --git a/util/metautils/nicemd_test.go b/util/metautils/nicemd_test.go index 0ffe0a9d9..f15760e82 100644 --- a/util/metautils/nicemd_test.go +++ b/util/metautils/nicemd_test.go @@ -4,11 +4,11 @@ package metautils_test import ( + "context" "testing" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" "github.com/stretchr/testify/assert" - "golang.org/x/net/context" "google.golang.org/grpc/metadata" ) diff --git a/validator/validator.go b/validator/validator.go index c2b567a48..24ca77d1e 100644 --- a/validator/validator.go +++ b/validator/validator.go @@ -4,7 +4,8 @@ package grpc_validator import ( - "golang.org/x/net/context" + "context" + "google.golang.org/grpc" "google.golang.org/grpc/codes" ) diff --git a/wrappers.go b/wrappers.go index 597b86244..05ccfb3f2 100644 --- a/wrappers.go +++ b/wrappers.go @@ -4,7 +4,8 @@ package grpc_middleware import ( - "golang.org/x/net/context" + "context" + "google.golang.org/grpc" ) diff --git a/wrappers_test.go b/wrappers_test.go index 69c3b9b45..c34288ee6 100644 --- a/wrappers_test.go +++ b/wrappers_test.go @@ -4,10 +4,10 @@ package grpc_middleware import ( + "context" "testing" "github.com/stretchr/testify/assert" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" )