From 6aa857dfa1f2679e52ee76d888d2c858a98f3b87 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 28 Aug 2020 11:27:45 +0300 Subject: [PATCH] fixup deps Signed-off-by: Vasiliy Tolstov --- api/handler/rpc/stream.go | 2 +- codec/codec_test.go | 53 --------------------------------------- micro.go | 2 -- options.go | 2 ++ 4 files changed, 3 insertions(+), 56 deletions(-) delete mode 100644 codec/codec_test.go diff --git a/api/handler/rpc/stream.go b/api/handler/rpc/stream.go index 6eb089ef..b58823e8 100644 --- a/api/handler/rpc/stream.go +++ b/api/handler/rpc/stream.go @@ -12,9 +12,9 @@ import ( "github.com/gobwas/httphead" "github.com/gobwas/ws" "github.com/gobwas/ws/wsutil" + raw "github.com/unistack-org/micro-codec-bytes" "github.com/unistack-org/micro/v3/api" "github.com/unistack-org/micro/v3/client" - raw "github.com/unistack-org/micro/v3/codec/bytes" "github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/util/router" ) diff --git a/codec/codec_test.go b/codec/codec_test.go deleted file mode 100644 index a3c2546a..00000000 --- a/codec/codec_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package codec_test - -import ( - "io" - "testing" - - "github.com/unistack-org/micro/v3/codec" - "github.com/unistack-org/micro/v3/codec/bytes" - "github.com/unistack-org/micro/v3/codec/grpc" - "github.com/unistack-org/micro/v3/codec/json" - "github.com/unistack-org/micro/v3/codec/jsonrpc" - "github.com/unistack-org/micro/v3/codec/proto" - "github.com/unistack-org/micro/v3/codec/protorpc" - "github.com/unistack-org/micro/v3/codec/text" -) - -type testRWC struct{} - -func (rwc *testRWC) Read(p []byte) (n int, err error) { - return 0, nil -} - -func (rwc *testRWC) Write(p []byte) (n int, err error) { - return 0, nil -} - -func (rwc *testRWC) Close() error { - return nil -} - -func getCodecs(c io.ReadWriteCloser) map[string]codec.Codec { - return map[string]codec.Codec{ - "bytes": bytes.NewCodec(c), - "grpc": grpc.NewCodec(c), - "json": json.NewCodec(c), - "jsonrpc": jsonrpc.NewCodec(c), - "proto": proto.NewCodec(c), - "protorpc": protorpc.NewCodec(c), - "text": text.NewCodec(c), - } -} - -func Test_WriteEmptyBody(t *testing.T) { - for name, c := range getCodecs(&testRWC{}) { - err := c.Write(&codec.Message{ - Type: codec.Error, - Header: map[string]string{}, - }, nil) - if err != nil { - t.Fatalf("codec %s - expected no error when writing empty/nil body: %s", name, err) - } - } -} diff --git a/micro.go b/micro.go index bbf9d617..fe002853 100644 --- a/micro.go +++ b/micro.go @@ -71,8 +71,6 @@ type Event interface { // Type alias to satisfy the deprecation type Publisher = Event -type Option func(*Options) - var ( HeaderPrefix = "Micro-" ) diff --git a/options.go b/options.go index e59606bf..74b2825e 100644 --- a/options.go +++ b/options.go @@ -62,6 +62,8 @@ func newOptions(opts ...Option) Options { return opt } +type Option func(*Options) + // Broker to be used for service func Broker(b broker.Broker) Option { return func(o *Options) {