From 235d328b959be07cfd1030fd5e0113ea9771e93f Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 22 Mar 2021 10:28:36 +0300 Subject: [PATCH] drop old proto Signed-off-by: Vasiliy Tolstov --- go.mod | 3 +-- go.sum | 3 +-- proto.go | 19 ------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 94c41e1..0e5a97c 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,8 @@ module github.com/unistack-org/micro-codec-proto/v3 -go 1.15 +go 1.16 require ( - github.com/golang/protobuf v1.5.1 github.com/unistack-org/micro/v3 v3.2.24 google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index 456f07b..eea661f 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,7 @@ 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= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= diff --git a/proto.go b/proto.go index 2cd770c..e649574 100644 --- a/proto.go +++ b/proto.go @@ -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 {