diff --git a/client/container_checkpoint_opts.go b/client/container_checkpoint_opts.go index 4edb937f62..f11bde7de4 100644 --- a/client/container_checkpoint_opts.go +++ b/client/container_checkpoint_opts.go @@ -20,7 +20,6 @@ import ( "bytes" "context" "errors" - "fmt" "runtime" tasks "github.com/containerd/containerd/api/services/tasks/v1" @@ -118,7 +117,7 @@ func WithCheckpointRuntime(ctx context.Context, client *Client, c *containers.Co // WithCheckpointRW includes the rw in the checkpoint func WithCheckpointRW(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error { diffOpts := []diff.Opt{ - diff.WithReference(fmt.Sprintf("checkpoint-rw-%s", c.SnapshotKey)), + diff.WithReference("checkpoint-rw-" + c.SnapshotKey), } rw, err := rootfs.CreateDiff(ctx, c.SnapshotKey, diff --git a/client/image.go b/client/image.go index 04a3d66de2..0fb052105d 100644 --- a/client/image.go +++ b/client/image.go @@ -389,11 +389,11 @@ func (i *image) Unpack(ctx context.Context, snapshotterName string, opts ...Unpa cinfo := content.Info{ Digest: desc.Digest, Labels: map[string]string{ - fmt.Sprintf("containerd.io/gc.ref.snapshot.%s", snapshotterName): rootFS, + "containerd.io/gc.ref.snapshot." + snapshotterName: rootFS, }, } - _, err = cs.Update(ctx, cinfo, fmt.Sprintf("labels.containerd.io/gc.ref.snapshot.%s", snapshotterName)) + _, err = cs.Update(ctx, cinfo, "labels.containerd.io/gc.ref.snapshot."+snapshotterName) return err } diff --git a/client/snapshotter_opts_unix.go b/client/snapshotter_opts_unix.go index acd67ce9ec..04c600c5ef 100644 --- a/client/snapshotter_opts_unix.go +++ b/client/snapshotter_opts_unix.go @@ -21,6 +21,7 @@ package client import ( "context" "encoding/json" + "errors" "fmt" "slices" @@ -108,7 +109,7 @@ func resolveSnapshotOptions(ctx context.Context, client *Client, snapshotterName } if _, err := rsn.IDMap.RootPair(); err != nil { - return "", fmt.Errorf("container UID/GID mapping entries of 0 are required but not found") + return "", errors.New("container UID/GID mapping entries of 0 are required but not found") } usernsID, err := rsn.ID() diff --git a/client/task.go b/client/task.go index 8480b7f87c..a6ab7b3583 100644 --- a/client/task.go +++ b/client/task.go @@ -751,7 +751,7 @@ func (t *task) checkpointTask(ctx context.Context, index *v1.Index, request *tas func (t *task) checkpointRWSnapshot(ctx context.Context, index *v1.Index, snapshotterName string, id string) error { opts := []diff.Opt{ - diff.WithReference(fmt.Sprintf("checkpoint-rw-%s", id)), + diff.WithReference("checkpoint-rw-" + id), } rw, err := rootfs.CreateDiff(ctx, id, t.client.SnapshotService(snapshotterName), t.client.DiffService(), opts...) if err != nil { @@ -767,7 +767,7 @@ func (t *task) checkpointRWSnapshot(ctx context.Context, index *v1.Index, snapsh func (t *task) checkpointImage(ctx context.Context, index *v1.Index, image string) error { if image == "" { - return fmt.Errorf("cannot checkpoint image with empty name") + return errors.New("cannot checkpoint image with empty name") } ir, err := t.client.ImageService().Get(ctx, image) if err != nil {