drop old proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-03-22 10:28:36 +03:00
parent 7cb42bbd20
commit 235d328b95
3 changed files with 2 additions and 23 deletions

View File

@@ -5,8 +5,6 @@ import (
"io"
"io/ioutil"
// nolint: staticcheck
oldproto "github.com/golang/protobuf/proto"
"github.com/unistack-org/micro/v3/codec"
"google.golang.org/protobuf/proto"
)
@@ -21,8 +19,6 @@ func (c *protoCodec) Marshal(v interface{}) ([]byte, error) {
return m.Data, nil
case proto.Message:
return proto.Marshal(m)
case oldproto.Message:
return oldproto.Marshal(m)
}
return nil, codec.ErrInvalidMessage
}
@@ -38,8 +34,6 @@ func (c *protoCodec) Unmarshal(d []byte, v interface{}) error {
m.Data = d
case proto.Message:
return proto.Unmarshal(d, m)
case oldproto.Message:
return oldproto.Unmarshal(d, m)
}
return codec.ErrInvalidMessage
}
@@ -59,12 +53,6 @@ func (c *protoCodec) ReadBody(conn io.Reader, b interface{}) error {
}
m.Data = buf
return nil
case oldproto.Message:
buf, err := ioutil.ReadAll(conn)
if err != nil {
return err
}
return oldproto.Unmarshal(buf, m)
case proto.Message:
buf, err := ioutil.ReadAll(conn)
if err != nil {
@@ -82,13 +70,6 @@ func (c *protoCodec) Write(conn io.Writer, m *codec.Message, b interface{}) erro
case *codec.Frame:
_, err := conn.Write(m.Data)
return err
case oldproto.Message:
buf, err := oldproto.Marshal(m)
if err != nil {
return err
}
_, err = conn.Write(buf)
return err
case proto.Message:
buf, err := proto.Marshal(m)
if err != nil {