diff --git a/cmd/containerd-shim/main_unix.go b/cmd/containerd-shim/main_unix.go index 87b9f59e879a6..ac6f51c0329a5 100644 --- a/cmd/containerd-shim/main_unix.go +++ b/cmd/containerd-shim/main_unix.go @@ -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 } diff --git a/cmd/containerd/command/publish.go b/cmd/containerd/command/publish.go index 9a67359b02a66..166a74a384a7a 100644 --- a/cmd/containerd/command/publish.go +++ b/cmd/containerd/command/publish.go @@ -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 diff --git a/container_checkpoint_opts.go b/container_checkpoint_opts.go index aeb6229a591ef..915a30e0707de 100644 --- a/container_checkpoint_opts.go +++ b/container_checkpoint_opts.go @@ -29,6 +29,7 @@ import ( "github.com/containerd/containerd/images" "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/protobuf" + "github.com/containerd/containerd/protobuf/proto" "github.com/containerd/containerd/rootfs" "github.com/containerd/containerd/runtime/v2/runc/options" "github.com/opencontainers/go-digest" @@ -79,7 +80,7 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta }) } // save copts - data, err := any.Marshal() + data, err := proto.Marshal(any) if err != nil { return err } @@ -99,7 +100,8 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta // WithCheckpointRuntime includes the container runtime info func WithCheckpointRuntime(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error { if c.Runtime.Options != nil && c.Runtime.Options.GetValue() != nil { - data, err := protobuf.FromAny(c.Runtime.Options).Marshal() + any := protobuf.FromAny(c.Runtime.Options) + data, err := proto.Marshal(any) if err != nil { return err } diff --git a/runtime/v2/binary.go b/runtime/v2/binary.go index ba532946180a4..0b14af67b1ed3 100644 --- a/runtime/v2/binary.go +++ b/runtime/v2/binary.go @@ -30,6 +30,7 @@ import ( "github.com/containerd/containerd/log" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/protobuf" + "github.com/containerd/containerd/protobuf/proto" "github.com/containerd/containerd/protobuf/types" "github.com/containerd/containerd/runtime" client "github.com/containerd/containerd/runtime/v2/shim" @@ -185,7 +186,7 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) { log.G(ctx).Warnf("cleanup warnings %s", s) } var response task.DeleteResponse - if err := response.Unmarshal(out.Bytes()); err != nil { + if err := proto.Unmarshal(out.Bytes(), &response); err != nil { return nil, err } if err := b.bundle.Delete(); err != nil { diff --git a/services/tasks/local.go b/services/tasks/local.go index b39cf16c70eef..f44df1544c18e 100644 --- a/services/tasks/local.go +++ b/services/tasks/local.go @@ -42,6 +42,7 @@ import ( "github.com/containerd/containerd/pkg/timeout" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/protobuf" + "github.com/containerd/containerd/protobuf/proto" ptypes "github.com/containerd/containerd/protobuf/types" "github.com/containerd/containerd/runtime" "github.com/containerd/containerd/runtime/linux/runctypes" @@ -579,7 +580,8 @@ func (l *local) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest, _ return nil, err } // write the config to the content store - data, err := protobuf.FromAny(container.Spec).Marshal() + pbany := protobuf.FromAny(container.Spec) + data, err := proto.Marshal(pbany) if err != nil { return nil, err }