cleanup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
59540c055e
commit
39c136a2c7
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=
|
||||
|
16
jsonpb.go
16
jsonpb.go
@ -10,7 +10,6 @@ import (
|
||||
oldjsonpb "github.com/golang/protobuf/jsonpb"
|
||||
// nolint: staticcheck
|
||||
oldproto "github.com/golang/protobuf/proto"
|
||||
mproto "github.com/unistack-org/micro-proto/proto"
|
||||
"github.com/unistack-org/micro/v3/codec"
|
||||
jsonpb "google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -45,8 +44,6 @@ func (c *jsonpbCodec) 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:
|
||||
@ -65,9 +62,6 @@ func (c *jsonpbCodec) Unmarshal(d []byte, v interface{}) error {
|
||||
switch m := v.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case *mproto.Frame:
|
||||
m.Data = d
|
||||
return nil
|
||||
case *codec.Frame:
|
||||
m.Data = d
|
||||
return nil
|
||||
@ -86,13 +80,6 @@ func (c *jsonpbCodec) 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 {
|
||||
@ -116,9 +103,6 @@ func (c *jsonpbCodec) Write(conn io.Writer, m *codec.Message, b interface{}) err
|
||||
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…
Reference in New Issue
Block a user