Use proto.Marshal instead of calling Marshal() on objects
With google.golang.org/protobuf, proto-generated objects only have ProtoReflect(). They don't have Marshal() anymore (see #6564). Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
@@ -39,6 +39,7 @@ import (
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/containerd/containerd/pkg/process"
|
||||
"github.com/containerd/containerd/protobuf"
|
||||
"github.com/containerd/containerd/protobuf/proto"
|
||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||
shimlog "github.com/containerd/containerd/runtime/v1"
|
||||
"github.com/containerd/containerd/runtime/v1/shim"
|
||||
@@ -305,7 +306,7 @@ func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
data, err := encoded.Marshal()
|
||||
data, err := proto.Marshal(encoded)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/containerd/containerd/pkg/dialer"
|
||||
"github.com/containerd/containerd/protobuf/proto"
|
||||
"github.com/containerd/containerd/protobuf/types"
|
||||
"github.com/urfave/cli"
|
||||
"google.golang.org/grpc"
|
||||
@@ -78,7 +79,7 @@ func getEventPayload(r io.Reader) (*types.Any, error) {
|
||||
return nil, err
|
||||
}
|
||||
var any types.Any
|
||||
if err := any.Unmarshal(data); err != nil {
|
||||
if err := proto.Unmarshal(data, &any); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &any, nil
|
||||
|
||||
Reference in New Issue
Block a user