cleanup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
710b97bbb7
commit
bcf7b8bb5c
1
go.mod
1
go.mod
@ -4,7 +4,6 @@ go 1.15
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.4.3
|
||||
github.com/unistack-org/micro-proto v0.0.2-0.20210307161332-120b8d428313
|
||||
github.com/unistack-org/micro/v3 v3.2.20
|
||||
google.golang.org/protobuf v1.25.0
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -29,8 +29,6 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
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/go.mod h1:y+fV+BPNK2IqGoLquRU396jTYifG0HCw3zxFfI4E0dc=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
|
15
proto.go
15
proto.go
@ -7,7 +7,6 @@ import (
|
||||
|
||||
// nolint: staticcheck
|
||||
oldproto "github.com/golang/protobuf/proto"
|
||||
mproto "github.com/unistack-org/micro-proto/proto"
|
||||
"github.com/unistack-org/micro/v3/codec"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -18,8 +17,6 @@ func (c *protoCodec) Marshal(v interface{}) ([]byte, error) {
|
||||
switch m := v.(type) {
|
||||
case nil:
|
||||
return nil, nil
|
||||
case *mproto.Frame:
|
||||
return m.Data, nil
|
||||
case *codec.Frame:
|
||||
return m.Data, nil
|
||||
case proto.Message:
|
||||
@ -37,8 +34,6 @@ func (c *protoCodec) Unmarshal(d []byte, v interface{}) error {
|
||||
switch m := v.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case *mproto.Frame:
|
||||
m.Data = d
|
||||
case *codec.Frame:
|
||||
m.Data = d
|
||||
case proto.Message:
|
||||
@ -57,13 +52,6 @@ func (c *protoCodec) ReadBody(conn io.Reader, b interface{}) error {
|
||||
switch m := b.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case *mproto.Frame:
|
||||
buf, err := ioutil.ReadAll(conn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m.Data = buf
|
||||
return nil
|
||||
case *codec.Frame:
|
||||
buf, err := ioutil.ReadAll(conn)
|
||||
if err != nil {
|
||||
@ -91,9 +79,6 @@ func (c *protoCodec) Write(conn io.Writer, m *codec.Message, b interface{}) erro
|
||||
switch m := b.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case *mproto.Frame:
|
||||
_, err := conn.Write(m.Data)
|
||||
return err
|
||||
case *codec.Frame:
|
||||
_, err := conn.Write(m.Data)
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user