drop old proto
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
2b3dacda1f
commit
2d6ade83c0
3
go.mod
3
go.mod
@ -1,11 +1,10 @@
|
||||
module github.com/unistack-org/micro-codec-segmentio/v3
|
||||
|
||||
go 1.14
|
||||
go 1.16
|
||||
|
||||
// github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.5.1
|
||||
github.com/segmentio/encoding v0.2.11
|
||||
github.com/unistack-org/micro/v3 v3.2.24
|
||||
google.golang.org/protobuf v1.26.0
|
||||
|
3
go.sum
3
go.sum
@ -1,8 +1,6 @@
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/ef-ds/deque v1.0.4/go.mod h1:gXDnTC3yqvBcHbq2lcExjtAcVrOnJCbMcZXmuj8Z4tg=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
|
||||
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
@ -11,6 +9,7 @@ github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTK
|
||||
github.com/segmentio/encoding v0.2.11 h1:gl/gUEcUyiwW7U6f5INT31zs7eGHA8OGVYuryuZDa68=
|
||||
github.com/segmentio/encoding v0.2.11/go.mod h1:MJjRE6bMDocliO2FyFC2Dusp+uYdBfHWh5Bw7QyExto=
|
||||
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
||||
github.com/unistack-org/micro/v3 v3.2.24 h1:3sQ72wy8Vap9KDD7bdLOn+dhlPT0iXSJRXhs2qHoKxA=
|
||||
github.com/unistack-org/micro/v3 v3.2.24/go.mod h1:iJwCWq2PECMxigfqe6TPC5GLWvj6P94Kk+PTVZGL3w8=
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
@ -5,8 +5,6 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
// nolint: staticcheck
|
||||
oldproto "github.com/golang/protobuf/proto"
|
||||
"github.com/segmentio/encoding/proto"
|
||||
"github.com/unistack-org/micro/v3/codec"
|
||||
newproto "google.golang.org/protobuf/proto"
|
||||
@ -20,7 +18,7 @@ func (c *protoCodec) Marshal(v interface{}) ([]byte, error) {
|
||||
return nil, nil
|
||||
case *codec.Frame:
|
||||
return m.Data, nil
|
||||
case newproto.Message, oldproto.Message, proto.Message:
|
||||
case newproto.Message, proto.Message:
|
||||
return proto.Marshal(m)
|
||||
}
|
||||
return nil, codec.ErrInvalidMessage
|
||||
@ -36,7 +34,7 @@ func (c *protoCodec) Unmarshal(d []byte, v interface{}) error {
|
||||
return nil
|
||||
case *codec.Frame:
|
||||
m.Data = d
|
||||
case newproto.Message, oldproto.Message, proto.Message:
|
||||
case newproto.Message, proto.Message:
|
||||
err = proto.Unmarshal(d, m)
|
||||
default:
|
||||
err = codec.ErrInvalidMessage
|
||||
@ -59,7 +57,7 @@ func (c *protoCodec) ReadBody(conn io.Reader, b interface{}) error {
|
||||
}
|
||||
m.Data = buf
|
||||
return nil
|
||||
case oldproto.Message, newproto.Message, proto.Message:
|
||||
case newproto.Message, proto.Message:
|
||||
buf, err := ioutil.ReadAll(conn)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -76,7 +74,7 @@ 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, newproto.Message, proto.Message:
|
||||
case newproto.Message, proto.Message:
|
||||
buf, err := proto.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user