Explorar el Código

use consistent alias for containerd's errdefs package

The signatures of functions in containerd's errdefs packages are very
similar to those in our own, and it's easy to accidentally use the wrong
package.

This patch uses a consistent alias for all occurrences of this import.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn hace 2 años
padre
commit
81e62af94a

+ 7 - 7
api/server/httpstatus/status.go

@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"fmt"
 	"net/http"
 	"net/http"
 
 
-	containerderrors "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/docker/distribution/registry/api/errcode"
 	"github.com/docker/distribution/registry/api/errcode"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
@@ -132,17 +132,17 @@ func statusCodeFromDistributionError(err error) int {
 // consumed directly (not through gRPC)
 // consumed directly (not through gRPC)
 func statusCodeFromContainerdError(err error) int {
 func statusCodeFromContainerdError(err error) int {
 	switch {
 	switch {
-	case containerderrors.IsInvalidArgument(err):
+	case cerrdefs.IsInvalidArgument(err):
 		return http.StatusBadRequest
 		return http.StatusBadRequest
-	case containerderrors.IsNotFound(err):
+	case cerrdefs.IsNotFound(err):
 		return http.StatusNotFound
 		return http.StatusNotFound
-	case containerderrors.IsAlreadyExists(err):
+	case cerrdefs.IsAlreadyExists(err):
 		return http.StatusConflict
 		return http.StatusConflict
-	case containerderrors.IsFailedPrecondition(err):
+	case cerrdefs.IsFailedPrecondition(err):
 		return http.StatusPreconditionFailed
 		return http.StatusPreconditionFailed
-	case containerderrors.IsUnavailable(err):
+	case cerrdefs.IsUnavailable(err):
 		return http.StatusServiceUnavailable
 		return http.StatusServiceUnavailable
-	case containerderrors.IsNotImplemented(err):
+	case cerrdefs.IsNotImplemented(err):
 		return http.StatusNotImplemented
 		return http.StatusNotImplemented
 	default:
 	default:
 		return http.StatusInternalServerError
 		return http.StatusInternalServerError

+ 2 - 2
builder/builder-next/adapters/containerimage/pull.go

@@ -10,7 +10,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
-	containerderrors "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/gc"
 	"github.com/containerd/containerd/gc"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/leases"
@@ -712,7 +712,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store, pw progr
 			if !j.done {
 			if !j.done {
 				info, err := cs.Info(context.TODO(), j.Digest)
 				info, err := cs.Info(context.TODO(), j.Digest)
 				if err != nil {
 				if err != nil {
-					if containerderrors.IsNotFound(err) {
+					if cerrdefs.IsNotFound(err) {
 						// _ = pw.Write(j.Digest.String(), progress.Status{
 						// _ = pw.Write(j.Digest.String(), progress.Status{
 						// 	Action: "waiting",
 						// 	Action: "waiting",
 						// })
 						// })

+ 3 - 3
builder/builder-next/adapters/snapshot/snapshot.go

@@ -7,7 +7,7 @@ import (
 	"strings"
 	"strings"
 	"sync"
 	"sync"
 
 
-	"github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/mount"
 	"github.com/containerd/containerd/mount"
 	"github.com/containerd/containerd/snapshots"
 	"github.com/containerd/containerd/snapshots"
@@ -204,7 +204,7 @@ func (s *snapshotter) getGraphDriverID(key string) (string, bool) {
 	if err := s.db.View(func(tx *bolt.Tx) error {
 	if err := s.db.View(func(tx *bolt.Tx) error {
 		b := tx.Bucket([]byte(key))
 		b := tx.Bucket([]byte(key))
 		if b == nil {
 		if b == nil {
-			return errors.Wrapf(errdefs.ErrNotFound, "key %s", key)
+			return errors.Wrapf(cerrdefs.ErrNotFound, "key %s", key)
 		}
 		}
 		v := b.Get(keyCommitted)
 		v := b.Get(keyCommitted)
 		if v != nil {
 		if v != nil {
@@ -248,7 +248,7 @@ func (s *snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, err
 	if err := s.db.View(func(tx *bolt.Tx) error {
 	if err := s.db.View(func(tx *bolt.Tx) error {
 		b := tx.Bucket([]byte(id))
 		b := tx.Bucket([]byte(id))
 		if b == nil && l == nil {
 		if b == nil && l == nil {
-			return errors.Wrapf(errdefs.ErrNotFound, "snapshot %s", id)
+			return errors.Wrapf(cerrdefs.ErrNotFound, "snapshot %s", id)
 		}
 		}
 		inf.Name = key
 		inf.Name = key
 		if b != nil {
 		if b != nil {

+ 2 - 2
daemon/images/image.go

@@ -7,7 +7,7 @@ import (
 	"io"
 	"io"
 
 
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
-	c8derrdefs "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/platforms"
 	"github.com/containerd/containerd/platforms"
@@ -83,7 +83,7 @@ func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.I
 
 
 		ra, err := i.content.ReaderAt(ctx, specs.Descriptor{Digest: digest.Digest(r.ID)})
 		ra, err := i.content.ReaderAt(ctx, specs.Descriptor{Digest: digest.Digest(r.ID)})
 		if err != nil {
 		if err != nil {
-			if c8derrdefs.IsNotFound(err) {
+			if cerrdefs.IsNotFound(err) {
 				continue
 				continue
 			}
 			}
 			logger.WithError(err).Error("Error looking up referenced manifest list for image")
 			logger.WithError(err).Error("Error looking up referenced manifest list for image")

+ 5 - 5
daemon/images/store.go

@@ -5,7 +5,7 @@ import (
 	"sync"
 	"sync"
 
 
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
-	c8derrdefs "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/log"
 	"github.com/containerd/containerd/log"
 	"github.com/containerd/containerd/namespaces"
 	"github.com/containerd/containerd/namespaces"
@@ -38,7 +38,7 @@ type imageStoreWithLease struct {
 
 
 func (s *imageStoreWithLease) Delete(id image.ID) ([]layer.Metadata, error) {
 func (s *imageStoreWithLease) Delete(id image.ID) ([]layer.Metadata, error) {
 	ctx := namespaces.WithNamespace(context.TODO(), s.ns)
 	ctx := namespaces.WithNamespace(context.TODO(), s.ns)
-	if err := s.leases.Delete(ctx, leases.Lease{ID: imageKey(id.String())}); err != nil && !c8derrdefs.IsNotFound(err) {
+	if err := s.leases.Delete(ctx, leases.Lease{ID: imageKey(id.String())}); err != nil && !cerrdefs.IsNotFound(err) {
 		return nil, errors.Wrap(err, "error deleting lease")
 		return nil, errors.Wrap(err, "error deleting lease")
 	}
 	}
 	return s.Store.Delete(id)
 	return s.Store.Delete(id)
@@ -72,7 +72,7 @@ func (s *imageStoreForPull) updateLease(ctx context.Context, dgst digest.Digest)
 	leaseID := imageKey(dgst.String())
 	leaseID := imageKey(dgst.String())
 	lease, err := s.leases.Create(ctx, leases.WithID(leaseID))
 	lease, err := s.leases.Create(ctx, leases.WithID(leaseID))
 	if err != nil {
 	if err != nil {
-		if !c8derrdefs.IsAlreadyExists(err) {
+		if !cerrdefs.IsAlreadyExists(err) {
 			return errors.Wrap(err, "error creating lease")
 			return errors.Wrap(err, "error creating lease")
 		}
 		}
 		lease = leases.Lease{ID: leaseID}
 		lease = leases.Lease{ID: leaseID}
@@ -125,7 +125,7 @@ func (c *contentStoreForPull) getDigested() []digest.Digest {
 func (c *contentStoreForPull) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) {
 func (c *contentStoreForPull) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) {
 	w, err := c.ContentStore.Writer(ctx, opts...)
 	w, err := c.ContentStore.Writer(ctx, opts...)
 	if err != nil {
 	if err != nil {
-		if c8derrdefs.IsAlreadyExists(err) {
+		if cerrdefs.IsAlreadyExists(err) {
 			var cfg content.WriterOpts
 			var cfg content.WriterOpts
 			for _, o := range opts {
 			for _, o := range opts {
 				if err := o(&cfg); err != nil {
 				if err := o(&cfg); err != nil {
@@ -149,7 +149,7 @@ type contentWriter struct {
 
 
 func (w *contentWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error {
 func (w *contentWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error {
 	err := w.Writer.Commit(ctx, size, expected, opts...)
 	err := w.Writer.Commit(ctx, size, expected, opts...)
-	if err == nil || c8derrdefs.IsAlreadyExists(err) {
+	if err == nil || cerrdefs.IsAlreadyExists(err) {
 		w.cs.addDigested(expected)
 		w.cs.addDigested(expected)
 	}
 	}
 	return err
 	return err

+ 2 - 2
daemon/images/store_test.go

@@ -8,7 +8,7 @@ import (
 
 
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content/local"
 	"github.com/containerd/containerd/content/local"
-	c8derrdefs "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/leases"
 	"github.com/containerd/containerd/metadata"
 	"github.com/containerd/containerd/metadata"
 	"github.com/containerd/containerd/namespaces"
 	"github.com/containerd/containerd/namespaces"
@@ -117,7 +117,7 @@ func TestContentStoreForPull(t *testing.T) {
 	// Test already exists
 	// Test already exists
 	csP.digested = nil
 	csP.digested = nil
 	_, err = csP.Writer(ctx, content.WithRef(t.Name()), content.WithDescriptor(desc))
 	_, err = csP.Writer(ctx, content.WithRef(t.Name()), content.WithDescriptor(desc))
-	assert.Check(t, c8derrdefs.IsAlreadyExists(err))
+	assert.Check(t, cerrdefs.IsAlreadyExists(err))
 	assert.Equal(t, len(csP.digested), 1)
 	assert.Equal(t, len(csP.digested), 1)
 	assert.Check(t, is.Equal(csP.digested[0], desc.Digest))
 	assert.Check(t, is.Equal(csP.digested[0], desc.Digest))
 }
 }

+ 4 - 4
distribution/manifest.go

@@ -8,7 +8,7 @@ import (
 	"strings"
 	"strings"
 
 
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
-	"github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/log"
 	"github.com/containerd/containerd/log"
 	"github.com/containerd/containerd/remotes"
 	"github.com/containerd/containerd/remotes"
 	"github.com/docker/distribution"
 	"github.com/docker/distribution"
@@ -124,7 +124,7 @@ func (m *manifestStore) getLocal(ctx context.Context, desc specs.Descriptor, ref
 			}
 			}
 
 
 			if !exists {
 			if !exists {
-				return nil, errors.Wrapf(errdefs.ErrNotFound, "manifest %v not found", desc.Digest)
+				return nil, errors.Wrapf(cerrdefs.ErrNotFound, "manifest %v not found", desc.Digest)
 			}
 			}
 
 
 		}
 		}
@@ -180,7 +180,7 @@ func (m *manifestStore) Get(ctx context.Context, desc specs.Descriptor, ref refe
 		// here. We may not even have the content locally, and this is fine, but
 		// here. We may not even have the content locally, and this is fine, but
 		// if we do we should determine that.
 		// if we do we should determine that.
 		mt, err := m.getMediaType(ctx, desc)
 		mt, err := m.getMediaType(ctx, desc)
-		if err != nil && !errdefs.IsNotFound(err) {
+		if err != nil && !cerrdefs.IsNotFound(err) {
 			l.WithError(err).Warn("Error looking up media type of content")
 			l.WithError(err).Warn("Error looking up media type of content")
 		}
 		}
 		desc.MediaType = mt
 		desc.MediaType = mt
@@ -193,7 +193,7 @@ func (m *manifestStore) Get(ctx context.Context, desc specs.Descriptor, ref refe
 	// ref count on the content.
 	// ref count on the content.
 	w, err := m.local.Writer(ctx, content.WithDescriptor(desc), content.WithRef(key))
 	w, err := m.local.Writer(ctx, content.WithDescriptor(desc), content.WithRef(key))
 	if err != nil {
 	if err != nil {
-		if errdefs.IsAlreadyExists(err) {
+		if cerrdefs.IsAlreadyExists(err) {
 			var manifest distribution.Manifest
 			var manifest distribution.Manifest
 			if manifest, err = m.getLocal(ctx, desc, ref); err == nil {
 			if manifest, err = m.getLocal(ctx, desc, ref); err == nil {
 				return manifest, nil
 				return manifest, nil

+ 4 - 4
distribution/manifest_test.go

@@ -10,7 +10,7 @@ import (
 
 
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content/local"
 	"github.com/containerd/containerd/content/local"
-	"github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/remotes"
 	"github.com/containerd/containerd/remotes"
 	"github.com/docker/distribution"
 	"github.com/docker/distribution"
 	"github.com/docker/distribution/manifest/manifestlist"
 	"github.com/docker/distribution/manifest/manifestlist"
@@ -188,7 +188,7 @@ func TestManifestStore(t *testing.T) {
 	checkIngest := func(t *testing.T, cs content.Store, desc specs.Descriptor) {
 	checkIngest := func(t *testing.T, cs content.Store, desc specs.Descriptor) {
 		ingestKey := remotes.MakeRefKey(ctx, desc)
 		ingestKey := remotes.MakeRefKey(ctx, desc)
 		_, err := cs.Status(ctx, ingestKey)
 		_, err := cs.Status(ctx, ingestKey)
-		assert.Check(t, errdefs.IsNotFound(err), err)
+		assert.Check(t, cerrdefs.IsNotFound(err), err)
 	}
 	}
 
 
 	t.Run("no remote or local", func(t *testing.T) {
 	t.Run("no remote or local", func(t *testing.T) {
@@ -323,7 +323,7 @@ func TestManifestStore(t *testing.T) {
 
 
 			_, err = cs.Info(ctx, desc.Digest)
 			_, err = cs.Info(ctx, desc.Digest)
 			// Nothing here since we couldn't persist
 			// Nothing here since we couldn't persist
-			assert.Check(t, errdefs.IsNotFound(err), err)
+			assert.Check(t, cerrdefs.IsNotFound(err), err)
 		})
 		})
 
 
 		t.Run("error on commit", func(t *testing.T) {
 		t.Run("error on commit", func(t *testing.T) {
@@ -342,7 +342,7 @@ func TestManifestStore(t *testing.T) {
 
 
 			_, err = cs.Info(ctx, desc.Digest)
 			_, err = cs.Info(ctx, desc.Digest)
 			// Nothing here since we couldn't persist
 			// Nothing here since we couldn't persist
-			assert.Check(t, errdefs.IsNotFound(err), err)
+			assert.Check(t, cerrdefs.IsNotFound(err), err)
 		})
 		})
 	})
 	})
 }
 }

+ 2 - 2
integration/container/pause_test.go

@@ -6,7 +6,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	containerderrdefs "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/api/types/events"
@@ -64,7 +64,7 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
 
 
 	err := client.ContainerPause(ctx, cID)
 	err := client.ContainerPause(ctx, cID)
-	assert.Check(t, is.ErrorContains(err, containerderrdefs.ErrNotImplemented.Error()))
+	assert.Check(t, is.ErrorContains(err, cerrdefs.ErrNotImplemented.Error()))
 }
 }
 
 
 func TestPauseStopPausedContainer(t *testing.T) {
 func TestPauseStopPausedContainer(t *testing.T) {

+ 5 - 6
libcontainerd/local/local_windows.go

@@ -18,8 +18,7 @@ import (
 	"github.com/Microsoft/hcsshim"
 	"github.com/Microsoft/hcsshim"
 	"github.com/containerd/containerd"
 	"github.com/containerd/containerd"
 	"github.com/containerd/containerd/cio"
 	"github.com/containerd/containerd/cio"
-	containerderrdefs "github.com/containerd/containerd/errdefs"
-
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/libcontainerd/queue"
 	"github.com/docker/docker/libcontainerd/queue"
 	libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
 	libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
@@ -397,7 +396,7 @@ func (ctr *container) Start(_ context.Context, _ string, withStdin bool, attachS
 	case ctr.ociSpec == nil:
 	case ctr.ociSpec == nil:
 		return nil, errors.WithStack(errdefs.NotImplemented(errors.New("a restored container cannot be started")))
 		return nil, errors.WithStack(errdefs.NotImplemented(errors.New("a restored container cannot be started")))
 	case ctr.task != nil:
 	case ctr.task != nil:
-		return nil, errors.WithStack(errdefs.NotModified(containerderrdefs.ErrAlreadyExists))
+		return nil, errors.WithStack(errdefs.NotModified(cerrdefs.ErrAlreadyExists))
 	}
 	}
 
 
 	logger := ctr.client.logger.WithField("container", ctr.id)
 	logger := ctr.client.logger.WithField("container", ctr.id)
@@ -520,7 +519,7 @@ func (ctr *container) Task(context.Context) (libcontainerdtypes.Task, error) {
 	ctr.mu.Lock()
 	ctr.mu.Lock()
 	defer ctr.mu.Unlock()
 	defer ctr.mu.Unlock()
 	if ctr.task == nil {
 	if ctr.task == nil {
-		return nil, errdefs.NotFound(containerderrdefs.ErrNotFound)
+		return nil, errdefs.NotFound(cerrdefs.ErrNotFound)
 	}
 	}
 	return ctr.task, nil
 	return ctr.task, nil
 }
 }
@@ -772,7 +771,7 @@ func (p *process) CloseStdin(context.Context) error {
 // Pause handles pause requests for containers
 // Pause handles pause requests for containers
 func (t *task) Pause(_ context.Context) error {
 func (t *task) Pause(_ context.Context) error {
 	if t.ctr.ociSpec.Windows.HyperV == nil {
 	if t.ctr.ociSpec.Windows.HyperV == nil {
-		return containerderrdefs.ErrNotImplemented
+		return cerrdefs.ErrNotImplemented
 	}
 	}
 
 
 	t.ctr.mu.Lock()
 	t.ctr.mu.Lock()
@@ -908,7 +907,7 @@ func (c *client) LoadContainer(ctx context.Context, id string) (libcontainerdtyp
 // re-attach isn't possible (see LoadContainer), a NotFound error is
 // re-attach isn't possible (see LoadContainer), a NotFound error is
 // unconditionally returned to allow restore to make progress.
 // unconditionally returned to allow restore to make progress.
 func (*container) AttachTask(context.Context, libcontainerdtypes.StdioCallback) (libcontainerdtypes.Task, error) {
 func (*container) AttachTask(context.Context, libcontainerdtypes.StdioCallback) (libcontainerdtypes.Task, error) {
-	return nil, errdefs.NotFound(containerderrdefs.ErrNotImplemented)
+	return nil, errdefs.NotFound(cerrdefs.ErrNotImplemented)
 }
 }
 
 
 // Pids returns a list of process IDs running in a container. It is not
 // Pids returns a list of process IDs running in a container. It is not

+ 5 - 5
libcontainerd/remote/client.go

@@ -19,7 +19,7 @@ import (
 	"github.com/containerd/containerd/archive"
 	"github.com/containerd/containerd/archive"
 	"github.com/containerd/containerd/cio"
 	"github.com/containerd/containerd/cio"
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
-	containerderrors "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/events"
 	"github.com/containerd/containerd/events"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/images"
 	v2runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
 	v2runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
@@ -127,7 +127,7 @@ func (c *client) NewContainer(ctx context.Context, id string, ociSpec *specs.Spe
 
 
 	ctr, err := c.client.NewContainer(ctx, id, opts...)
 	ctr, err := c.client.NewContainer(ctx, id, opts...)
 	if err != nil {
 	if err != nil {
-		if containerderrors.IsAlreadyExists(err) {
+		if cerrdefs.IsAlreadyExists(err) {
 			return nil, errors.WithStack(errdefs.Conflict(errors.New("id already in use")))
 			return nil, errors.WithStack(errdefs.Conflict(errors.New("id already in use")))
 		}
 		}
 		return nil, wrapError(err)
 		return nil, wrapError(err)
@@ -285,7 +285,7 @@ func (t *task) Exec(ctx context.Context, processID string, spec *specs.Process,
 	})
 	})
 	if err != nil {
 	if err != nil {
 		close(stdinCloseSync)
 		close(stdinCloseSync)
-		if containerderrors.IsAlreadyExists(err) {
+		if cerrdefs.IsAlreadyExists(err) {
 			return nil, errors.WithStack(errdefs.Conflict(errors.New("id already in use")))
 			return nil, errors.WithStack(errdefs.Conflict(errors.New("id already in use")))
 		}
 		}
 		return nil, wrapError(err)
 		return nil, wrapError(err)
@@ -473,7 +473,7 @@ func (t *task) CreateCheckpoint(ctx context.Context, checkpointDir string, exit
 func (c *client) LoadContainer(ctx context.Context, id string) (libcontainerdtypes.Container, error) {
 func (c *client) LoadContainer(ctx context.Context, id string) (libcontainerdtypes.Container, error) {
 	ctr, err := c.client.LoadContainer(ctx, id)
 	ctr, err := c.client.LoadContainer(ctx, id)
 	if err != nil {
 	if err != nil {
-		if containerderrors.IsNotFound(err) {
+		if cerrdefs.IsNotFound(err) {
 			return nil, errors.WithStack(errdefs.NotFound(errors.New("no such container")))
 			return nil, errors.WithStack(errdefs.NotFound(errors.New("no such container")))
 		}
 		}
 		return nil, wrapError(err)
 		return nil, wrapError(err)
@@ -758,7 +758,7 @@ func wrapError(err error) error {
 	switch {
 	switch {
 	case err == nil:
 	case err == nil:
 		return nil
 		return nil
-	case containerderrors.IsNotFound(err):
+	case cerrdefs.IsNotFound(err):
 		return errdefs.NotFound(err)
 		return errdefs.NotFound(err)
 	}
 	}
 
 

+ 2 - 2
plugin/fetch_linux.go

@@ -7,7 +7,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/containerd/containerd/content"
 	"github.com/containerd/containerd/content"
-	c8derrdefs "github.com/containerd/containerd/errdefs"
+	cerrdefs "github.com/containerd/containerd/errdefs"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/remotes"
 	"github.com/containerd/containerd/remotes"
 	"github.com/containerd/containerd/remotes/docker"
 	"github.com/containerd/containerd/remotes/docker"
@@ -248,7 +248,7 @@ func withFetchProgress(cs content.Store, out progress.Output, ref reference.Name
 
 
 				s, err := cs.Status(ctx, key)
 				s, err := cs.Status(ctx, key)
 				if err != nil {
 				if err != nil {
-					if !c8derrdefs.IsNotFound(err) {
+					if !cerrdefs.IsNotFound(err) {
 						logrus.WithError(err).WithField("layerDigest", desc.Digest.String()).Error("Error looking up status of plugin layer pull")
 						logrus.WithError(err).WithField("layerDigest", desc.Digest.String()).Error("Error looking up status of plugin layer pull")
 						progress.Update(out, id, err.Error())
 						progress.Update(out, id, err.Error())
 						return
 						return