From 25abc921d51509b361b0dea2fe3b6007081800eb Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 15 Jun 2021 23:23:42 +0300 Subject: [PATCH] remove stale funcs Signed-off-by: Vasiliy Tolstov --- context.go | 16 ---------------- options.go | 6 +++--- 2 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 context.go diff --git a/context.go b/context.go deleted file mode 100644 index 6113d6d..0000000 --- a/context.go +++ /dev/null @@ -1,16 +0,0 @@ -package grpc - -import ( - "context" - - "github.com/unistack-org/micro/v3/server" -) - -func setServerOption(k, v interface{}) server.Option { - return func(o *server.Options) { - if o.Context == nil { - o.Context = context.Background() - } - o.Context = context.WithValue(o.Context, k, v) - } -} diff --git a/options.go b/options.go index 3501abb..a21d26f 100644 --- a/options.go +++ b/options.go @@ -32,7 +32,7 @@ func Codec(contentType string, c encoding.Codec) server.Option { // Options to be used to configure gRPC options func Options(opts ...grpc.ServerOption) server.Option { - return setServerOption(grpcOptions{}, opts) + return server.SetOption(grpcOptions{}, opts) } // @@ -40,10 +40,10 @@ func Options(opts ...grpc.ServerOption) server.Option { // send. Default maximum message size is 4 MB. // func MaxMsgSize(s int) server.Option { - return setServerOption(maxMsgSizeKey{}, s) + return server.SetOption(maxMsgSizeKey{}, s) } // Reflection enables reflection support in grpc server func Reflection(b bool) server.Option { - return setServerOption(reflectionKey{}, b) + return server.SetOption(reflectionKey{}, b) }