Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-03-07 22:39:18 +03:00
parent b825361a6b
commit 9c47c02280
3 changed files with 0 additions and 18 deletions

1
go.mod
View File

@ -7,7 +7,6 @@ go 1.14
require ( require (
github.com/golang/protobuf v1.4.3 github.com/golang/protobuf v1.4.3
github.com/segmentio/encoding v0.2.7 github.com/segmentio/encoding v0.2.7
github.com/unistack-org/micro-proto v0.0.2-0.20210307161332-120b8d428313
github.com/unistack-org/micro/v3 v3.2.20 github.com/unistack-org/micro/v3 v3.2.20
google.golang.org/protobuf v1.25.0 google.golang.org/protobuf v1.25.0
) )

2
go.sum
View File

@ -31,8 +31,6 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
github.com/segmentio/encoding v0.2.7 h1:TKxEiKbernCFCTFW5wnSlE21kIQpqcY/ABXjhc9YeJU= github.com/segmentio/encoding v0.2.7 h1:TKxEiKbernCFCTFW5wnSlE21kIQpqcY/ABXjhc9YeJU=
github.com/segmentio/encoding v0.2.7/go.mod h1:MJjRE6bMDocliO2FyFC2Dusp+uYdBfHWh5Bw7QyExto= github.com/segmentio/encoding v0.2.7/go.mod h1:MJjRE6bMDocliO2FyFC2Dusp+uYdBfHWh5Bw7QyExto=
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
github.com/unistack-org/micro-proto v0.0.2-0.20210307161332-120b8d428313 h1:6BWhJJPVlsvkll5GLtxyQgvyZJDnYLEn2FuSoNmtZ4A=
github.com/unistack-org/micro-proto v0.0.2-0.20210307161332-120b8d428313/go.mod h1:GYO53DWmeldRIo90cAdQx8bLr/WJMxW62W4ja74p1Ac=
github.com/unistack-org/micro/v3 v3.2.20 h1:EY94FDfHR43QvKNjmCaVH8/7+D8bmLwySXbFK9iIQY0= github.com/unistack-org/micro/v3 v3.2.20 h1:EY94FDfHR43QvKNjmCaVH8/7+D8bmLwySXbFK9iIQY0=
github.com/unistack-org/micro/v3 v3.2.20/go.mod h1:y+fV+BPNK2IqGoLquRU396jTYifG0HCw3zxFfI4E0dc= github.com/unistack-org/micro/v3 v3.2.20/go.mod h1:y+fV+BPNK2IqGoLquRU396jTYifG0HCw3zxFfI4E0dc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

View File

@ -8,7 +8,6 @@ import (
// nolint: staticcheck // nolint: staticcheck
oldproto "github.com/golang/protobuf/proto" oldproto "github.com/golang/protobuf/proto"
"github.com/segmentio/encoding/proto" "github.com/segmentio/encoding/proto"
mproto "github.com/unistack-org/micro-proto/proto"
"github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/codec"
newproto "google.golang.org/protobuf/proto" newproto "google.golang.org/protobuf/proto"
) )
@ -21,8 +20,6 @@ func (c *protoCodec) Marshal(v interface{}) ([]byte, error) {
return nil, nil return nil, nil
case *codec.Frame: case *codec.Frame:
return m.Data, nil return m.Data, nil
case *mproto.Frame:
return m.Data, nil
case newproto.Message, oldproto.Message, proto.Message: case newproto.Message, oldproto.Message, proto.Message:
return proto.Marshal(m) return proto.Marshal(m)
} }
@ -39,8 +36,6 @@ func (c *protoCodec) Unmarshal(d []byte, v interface{}) error {
return nil return nil
case *codec.Frame: case *codec.Frame:
m.Data = d m.Data = d
case *mproto.Frame:
m.Data = d
case newproto.Message, oldproto.Message, proto.Message: case newproto.Message, oldproto.Message, proto.Message:
err = proto.Unmarshal(d, m) err = proto.Unmarshal(d, m)
default: default:
@ -57,13 +52,6 @@ func (c *protoCodec) ReadBody(conn io.Reader, b interface{}) error {
switch m := b.(type) { switch m := b.(type) {
case nil: case nil:
return nil return nil
case *mproto.Frame:
buf, err := ioutil.ReadAll(conn)
if err != nil {
return err
}
m.Data = buf
return nil
case *codec.Frame: case *codec.Frame:
buf, err := ioutil.ReadAll(conn) buf, err := ioutil.ReadAll(conn)
if err != nil { if err != nil {
@ -85,9 +73,6 @@ func (c *protoCodec) Write(conn io.Writer, m *codec.Message, b interface{}) erro
switch m := b.(type) { switch m := b.(type) {
case nil: case nil:
return nil return nil
case *mproto.Frame:
_, err := conn.Write(m.Data)
return err
case *codec.Frame: case *codec.Frame:
_, err := conn.Write(m.Data) _, err := conn.Write(m.Data)
return err return err