feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io> Co-authored-by: zounengren <zouyee1989@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ package apply
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
@@ -27,7 +28,6 @@ import (
|
||||
"github.com/containerd/containerd/mount"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -64,13 +64,13 @@ func (s *fsApplier) Apply(ctx context.Context, desc ocispec.Descriptor, mounts [
|
||||
var config diff.ApplyConfig
|
||||
for _, o := range opts {
|
||||
if err := o(ctx, desc, &config); err != nil {
|
||||
return emptyDesc, errors.Wrap(err, "failed to apply config opt")
|
||||
return emptyDesc, fmt.Errorf("failed to apply config opt: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
ra, err := s.store.ReaderAt(ctx, desc)
|
||||
if err != nil {
|
||||
return emptyDesc, errors.Wrap(err, "failed to get reader from content store")
|
||||
return emptyDesc, fmt.Errorf("failed to get reader from content store: %w", err)
|
||||
}
|
||||
defer ra.Close()
|
||||
|
||||
@@ -79,7 +79,7 @@ func (s *fsApplier) Apply(ctx context.Context, desc ocispec.Descriptor, mounts [
|
||||
processors = append(processors, processor)
|
||||
for {
|
||||
if processor, err = diff.GetProcessor(ctx, processor, config.ProcessorPayloads); err != nil {
|
||||
return emptyDesc, errors.Wrapf(err, "failed to get stream processor for %s", desc.MediaType)
|
||||
return emptyDesc, fmt.Errorf("failed to get stream processor for %s: %w", desc.MediaType, err)
|
||||
}
|
||||
processors = append(processors, processor)
|
||||
if processor.MediaType() == ocispec.MediaTypeImageLayer {
|
||||
|
@@ -18,6 +18,7 @@ package apply
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
@@ -25,7 +26,6 @@ import (
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/pkg/userns"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func apply(ctx context.Context, mounts []mount.Mount, r io.Reader) error {
|
||||
@@ -86,7 +86,7 @@ func getOverlayPath(options []string) (upper string, lower []string, err error)
|
||||
}
|
||||
}
|
||||
if upper == "" {
|
||||
return "", nil, errors.Wrap(errdefs.ErrInvalidArgument, "upperdir not found")
|
||||
return "", nil, fmt.Errorf("upperdir not found: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
|
||||
return
|
||||
@@ -111,22 +111,22 @@ func getAufsPath(options []string) (upper string, lower []string, err error) {
|
||||
for _, b := range strings.Split(o, sep) {
|
||||
if strings.HasSuffix(b, rwSuffix) {
|
||||
if upper != "" {
|
||||
return "", nil, errors.Wrap(errdefs.ErrInvalidArgument, "multiple rw branch found")
|
||||
return "", nil, fmt.Errorf("multiple rw branch found: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
upper = strings.TrimSuffix(b, rwSuffix)
|
||||
} else if strings.HasSuffix(b, roSuffix) {
|
||||
if upper == "" {
|
||||
return "", nil, errors.Wrap(errdefs.ErrInvalidArgument, "rw branch be first")
|
||||
return "", nil, fmt.Errorf("rw branch be first: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
lower = append(lower, strings.TrimSuffix(b, roSuffix))
|
||||
} else {
|
||||
return "", nil, errors.Wrap(errdefs.ErrInvalidArgument, "unhandled aufs suffix")
|
||||
return "", nil, fmt.Errorf("unhandled aufs suffix: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if upper == "" {
|
||||
return "", nil, errors.Wrap(errdefs.ErrInvalidArgument, "rw branch not found")
|
||||
return "", nil, fmt.Errorf("rw branch not found: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user