replace deprecated method after transitive dependency update

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-07-23 10:06:52 +02:00
parent 12c2b470bc
commit c3f990f0a2
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
2 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,8 @@
package streams
import (
"github.com/golang/protobuf/ptypes"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
streamsv1 "github.com/docker/compose-cli/cli/server/protos/streams/v1"
)
@ -34,7 +35,7 @@ func (io *IO) Read(p []byte) (int, error) {
}
var m streamsv1.BytesMessage
err = ptypes.UnmarshalAny(a, &m)
err = anypb.UnmarshalTo(a, &m, proto.UnmarshalOptions{})
if err != nil {
return 0, err
}
@ -52,7 +53,7 @@ func (io *IO) Write(p []byte) (n int, err error) {
Value: p,
}
m, err := ptypes.MarshalAny(&message)
m, err := anypb.New(&message)
if err != nil {
return 0, err
}

View File

@ -24,7 +24,6 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/anypb"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/any"
"gotest.tools/v3/assert"
"gotest.tools/v3/assert/cmp"
@ -76,7 +75,7 @@ func getReader(t *testing.T, in []byte, errResult error) IO {
Type: streamsv1.IOStream_STDOUT,
Value: in,
}
m, err := ptypes.MarshalAny(&message)
m, err := anypb.New(&message)
assert.NilError(t, err)
return IO{
@ -90,7 +89,7 @@ func getReader(t *testing.T, in []byte, errResult error) IO {
}
func getAny(t *testing.T, in []byte) *any.Any {
value, err := ptypes.MarshalAny(&streamsv1.BytesMessage{
value, err := anypb.New(&streamsv1.BytesMessage{
Type: streamsv1.IOStream_STDOUT,
Value: in,
})