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:
@@ -17,12 +17,12 @@
|
||||
package containers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -88,7 +88,7 @@ var checkpointCommand = cli.Command{
|
||||
}
|
||||
defer func() {
|
||||
if err := task.Resume(ctx); err != nil {
|
||||
fmt.Println(errors.Wrap(err, "error resuming task"))
|
||||
fmt.Println(fmt.Errorf("error resuming task: %w", err))
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ import (
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/typeurl"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -66,17 +65,17 @@ var createCommand = cli.Command{
|
||||
if config {
|
||||
id = context.Args().First()
|
||||
if context.NArg() > 1 {
|
||||
return errors.Wrap(errdefs.ErrInvalidArgument, "with spec config file, only container id should be provided")
|
||||
return fmt.Errorf("with spec config file, only container id should be provided: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
} else {
|
||||
id = context.Args().Get(1)
|
||||
ref = context.Args().First()
|
||||
if ref == "" {
|
||||
return errors.Wrap(errdefs.ErrInvalidArgument, "image ref must be provided")
|
||||
return fmt.Errorf("image ref must be provided: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
}
|
||||
if id == "" {
|
||||
return errors.Wrap(errdefs.ErrInvalidArgument, "container id must be provided")
|
||||
return fmt.Errorf("container id must be provided: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
client, ctx, cancel, err := commands.NewClient(context)
|
||||
if err != nil {
|
||||
@@ -169,7 +168,7 @@ var deleteCommand = cli.Command{
|
||||
}
|
||||
|
||||
if context.NArg() == 0 {
|
||||
return errors.Wrap(errdefs.ErrInvalidArgument, "must specify at least one container to delete")
|
||||
return fmt.Errorf("must specify at least one container to delete: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
for _, arg := range context.Args() {
|
||||
if err := deleteContainer(ctx, client, arg, deleteOpts...); err != nil {
|
||||
@@ -215,7 +214,7 @@ var setLabelsCommand = cli.Command{
|
||||
Action: func(context *cli.Context) error {
|
||||
containerID, labels := commands.ObjectWithLabelArgs(context)
|
||||
if containerID == "" {
|
||||
return errors.Wrap(errdefs.ErrInvalidArgument, "container id must be provided")
|
||||
return fmt.Errorf("container id must be provided: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
client, ctx, cancel, err := commands.NewClient(context)
|
||||
if err != nil {
|
||||
@@ -257,7 +256,7 @@ var infoCommand = cli.Command{
|
||||
Action: func(context *cli.Context) error {
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return errors.Wrap(errdefs.ErrInvalidArgument, "container id must be provided")
|
||||
return fmt.Errorf("container id must be provided: %w", errdefs.ErrInvalidArgument)
|
||||
}
|
||||
client, ctx, cancel, err := commands.NewClient(context)
|
||||
if err != nil {
|
||||
|
@@ -17,11 +17,12 @@
|
||||
package containers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cio"
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package content
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -31,7 +32,6 @@ import (
|
||||
units "github.com/docker/go-units"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
exec "golang.org/x/sys/execabs"
|
||||
)
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package images
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
@@ -24,7 +25,6 @@ import (
|
||||
"github.com/containerd/containerd/images/converter/uncompress"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -74,7 +74,7 @@ When '--all-platforms' is given all images in a manifest list must be available.
|
||||
for _, ps := range pss {
|
||||
p, err := platforms.Parse(ps)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "invalid platform %q", ps)
|
||||
return fmt.Errorf("invalid platform %q: %w", ps, err)
|
||||
}
|
||||
all = append(all, p)
|
||||
}
|
||||
|
@@ -17,6 +17,8 @@
|
||||
package images
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
@@ -24,7 +26,6 @@ import (
|
||||
"github.com/containerd/containerd/images/archive"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -73,7 +74,7 @@ When '--all-platforms' is given all images in a manifest list must be available.
|
||||
for _, ps := range pss {
|
||||
p, err := platforms.Parse(ps)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "invalid platform %q", ps)
|
||||
return fmt.Errorf("invalid platform %q: %w", ps, err)
|
||||
}
|
||||
all = append(all, p)
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package images
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
@@ -29,7 +30,6 @@ import (
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/pkg/progress"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -82,7 +82,7 @@ var listCommand = cli.Command{
|
||||
)
|
||||
imageList, err := imageStore.List(ctx, filters...)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to list images")
|
||||
return fmt.Errorf("failed to list images: %w", err)
|
||||
}
|
||||
if quiet {
|
||||
for _, image := range imageList {
|
||||
@@ -224,7 +224,7 @@ var checkCommand = cli.Command{
|
||||
args := []string(context.Args())
|
||||
imageList, err := client.ListImages(ctx, args...)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed listing images")
|
||||
return fmt.Errorf("failed listing images: %w", err)
|
||||
}
|
||||
if len(imageList) == 0 {
|
||||
log.G(ctx).Debugf("no images found")
|
||||
@@ -248,7 +248,7 @@ var checkCommand = cli.Command{
|
||||
available, required, present, missing, err := images.Check(ctx, contentStore, image.Target(), platforms.Default())
|
||||
if err != nil {
|
||||
if exitErr == nil {
|
||||
exitErr = errors.Wrapf(err, "unable to check %v", image.Name())
|
||||
exitErr = fmt.Errorf("unable to check %v: %w", image.Name(), err)
|
||||
}
|
||||
log.G(ctx).WithError(err).Errorf("unable to check %v", image.Name())
|
||||
status = "error"
|
||||
@@ -284,7 +284,7 @@ var checkCommand = cli.Command{
|
||||
unpacked, err := image.IsUnpacked(ctx, context.String("snapshotter"))
|
||||
if err != nil {
|
||||
if exitErr == nil {
|
||||
exitErr = errors.Wrapf(err, "unable to check unpack for %v", image.Name())
|
||||
exitErr = fmt.Errorf("unable to check unpack for %v: %w", image.Name(), err)
|
||||
}
|
||||
log.G(ctx).WithError(err).Errorf("unable to check unpack for %v", image.Name())
|
||||
}
|
||||
@@ -340,7 +340,7 @@ var removeCommand = cli.Command{
|
||||
if err := imageStore.Delete(ctx, target, opts...); err != nil {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
if exitErr == nil {
|
||||
exitErr = errors.Wrapf(err, "unable to delete %v", target)
|
||||
exitErr = fmt.Errorf("unable to delete %v: %w", target, err)
|
||||
}
|
||||
log.G(ctx).WithError(err).Errorf("unable to delete %v", target)
|
||||
continue
|
||||
|
@@ -27,7 +27,6 @@ import (
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/opencontainers/image-spec/identity"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -93,7 +92,7 @@ When you are done, use the unmount command.
|
||||
ps := context.String("platform")
|
||||
p, err := platforms.Parse(ps)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "unable to parse platform %s", ps)
|
||||
return fmt.Errorf("unable to parse platform %s: %w", ps, err)
|
||||
}
|
||||
|
||||
img, err := client.ImageService().Get(ctx, ref)
|
||||
@@ -103,7 +102,7 @@ When you are done, use the unmount command.
|
||||
|
||||
i := containerd.NewImageWithPlatform(client, img, platforms.Only(p))
|
||||
if err := i.Unpack(ctx, snapshotter); err != nil {
|
||||
return errors.Wrap(err, "error unpacking image")
|
||||
return fmt.Errorf("error unpacking image: %w", err)
|
||||
}
|
||||
|
||||
diffIDs, err := i.RootFS(ctx)
|
||||
|
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/opencontainers/image-spec/identity"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -106,13 +105,13 @@ command. As part of this process, we do the following:
|
||||
if context.Bool("all-platforms") {
|
||||
p, err = images.Platforms(ctx, client.ContentStore(), img.Target)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unable to resolve image platforms")
|
||||
return fmt.Errorf("unable to resolve image platforms: %w", err)
|
||||
}
|
||||
} else {
|
||||
for _, s := range context.StringSlice("platform") {
|
||||
ps, err := platforms.Parse(s)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "unable to parse platform %s", s)
|
||||
return fmt.Errorf("unable to parse platform %s: %w", s, err)
|
||||
}
|
||||
p = append(p, ps)
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@ package images
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http/httptrace"
|
||||
"os"
|
||||
"sync"
|
||||
@@ -35,7 +37,6 @@ import (
|
||||
"github.com/containerd/containerd/remotes/docker"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
@@ -88,7 +89,7 @@ var pushCommand = cli.Command{
|
||||
if manifest := context.String("manifest"); manifest != "" {
|
||||
desc.Digest, err = digest.Parse(manifest)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "invalid manifest digest")
|
||||
return fmt.Errorf("invalid manifest digest: %w", err)
|
||||
}
|
||||
desc.MediaType = context.String("manifest-type")
|
||||
} else {
|
||||
@@ -97,14 +98,14 @@ var pushCommand = cli.Command{
|
||||
}
|
||||
img, err := client.ImageService().Get(ctx, local)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unable to resolve image to manifest")
|
||||
return fmt.Errorf("unable to resolve image to manifest: %w", err)
|
||||
}
|
||||
desc = img.Target
|
||||
|
||||
if pss := context.StringSlice("platform"); len(pss) == 1 {
|
||||
p, err := platforms.Parse(pss[0])
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "invalid platform %q", pss[0])
|
||||
return fmt.Errorf("invalid platform %q: %w", pss[0], err)
|
||||
}
|
||||
|
||||
cs := client.ContentStore()
|
||||
@@ -113,7 +114,7 @@ var pushCommand = cli.Command{
|
||||
for _, manifest := range manifests {
|
||||
if manifest.Platform != nil && matcher.Match(*manifest.Platform) {
|
||||
if _, err := images.Children(ctx, cs, manifest); err != nil {
|
||||
return errors.Wrap(err, "no matching manifest")
|
||||
return fmt.Errorf("no matching manifest: %w", err)
|
||||
}
|
||||
desc = manifest
|
||||
break
|
||||
|
@@ -23,7 +23,6 @@ import (
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/leases"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -60,10 +59,10 @@ var unmountCommand = cli.Command{
|
||||
snapshotter := context.String("snapshotter")
|
||||
s := client.SnapshotService(snapshotter)
|
||||
if err := client.LeasesService().Delete(ctx, leases.Lease{ID: target}); err != nil && !errdefs.IsNotFound(err) {
|
||||
return errors.Wrap(err, "error deleting lease")
|
||||
return fmt.Errorf("error deleting lease: %w", err)
|
||||
}
|
||||
if err := s.Remove(ctx, target); err != nil && !errdefs.IsNotFound(err) {
|
||||
return errors.Wrap(err, "error removing snapshot")
|
||||
return fmt.Errorf("error removing snapshot: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,6 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
"github.com/containerd/containerd/leases"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -69,7 +68,7 @@ var listCommand = cli.Command{
|
||||
|
||||
leaseList, err := ls.List(ctx, filters...)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to list leases")
|
||||
return fmt.Errorf("failed to list leases: %w", err)
|
||||
}
|
||||
if quiet {
|
||||
for _, l := range leaseList {
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package namespaces
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
@@ -26,7 +27,6 @@ import (
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -167,7 +167,7 @@ var removeCommand = cli.Command{
|
||||
if err := namespaces.Delete(ctx, target, opts...); err != nil {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
if exitErr == nil {
|
||||
exitErr = errors.Wrapf(err, "unable to delete %v", target)
|
||||
exitErr = fmt.Errorf("unable to delete %v: %w", target, err)
|
||||
}
|
||||
log.G(ctx).WithError(err).Errorf("unable to delete %v", target)
|
||||
continue
|
||||
|
@@ -17,7 +17,8 @@
|
||||
package oci
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
@@ -43,7 +44,7 @@ var defaultSpecCommand = cli.Command{
|
||||
|
||||
spec, err := oci.GenerateSpec(ctx, nil, &containers.Container{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to generate spec")
|
||||
return fmt.Errorf("failed to generate spec: %w", err)
|
||||
}
|
||||
|
||||
commands.PrintAsJSON(spec)
|
||||
|
@@ -24,7 +24,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/defaults"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -183,7 +182,7 @@ func httpGetRequest(client *http.Client, request string) (io.ReadCloser, error)
|
||||
return nil, err
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, errors.Errorf("http get failed with status: %s", resp.Status)
|
||||
return nil, fmt.Errorf("http get failed with status: %s", resp.Status)
|
||||
}
|
||||
return resp.Body, nil
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ import (
|
||||
gocontext "context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -34,7 +35,6 @@ import (
|
||||
"github.com/containerd/containerd/remotes"
|
||||
"github.com/containerd/containerd/remotes/docker"
|
||||
"github.com/containerd/containerd/remotes/docker/config"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -46,12 +46,12 @@ func passwordPrompt() (string, error) {
|
||||
defer c.Reset()
|
||||
|
||||
if err := c.DisableEcho(); err != nil {
|
||||
return "", errors.Wrap(err, "failed to disable echo")
|
||||
return "", fmt.Errorf("failed to disable echo: %w", err)
|
||||
}
|
||||
|
||||
line, _, err := bufio.NewReader(c).ReadLine()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to read line")
|
||||
return "", fmt.Errorf("failed to read line: %w", err)
|
||||
}
|
||||
return string(line), nil
|
||||
}
|
||||
@@ -126,7 +126,7 @@ func resolverDefaultTLS(clicontext *cli.Context) (*tls.Config, error) {
|
||||
if tlsRootPath := clicontext.String("tlscacert"); tlsRootPath != "" {
|
||||
tlsRootData, err := os.ReadFile(tlsRootPath)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to read %q", tlsRootPath)
|
||||
return nil, fmt.Errorf("failed to read %q: %w", tlsRootPath, err)
|
||||
}
|
||||
|
||||
config.RootCAs = x509.NewCertPool()
|
||||
@@ -143,7 +143,7 @@ func resolverDefaultTLS(clicontext *cli.Context) (*tls.Config, error) {
|
||||
}
|
||||
keyPair, err := tls.LoadX509KeyPair(tlsCertPath, tlsKeyPath)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to load TLS client credentials (cert=%q, key=%q)", tlsCertPath, tlsKeyPath)
|
||||
return nil, fmt.Errorf("failed to load TLS client credentials (cert=%q, key=%q): %w", tlsCertPath, tlsKeyPath, err)
|
||||
}
|
||||
config.Certificates = []tls.Certificate{keyPair}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ type DebugTransport struct {
|
||||
func (t DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
in, err := httputil.DumpRequest(req, true)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to dump request")
|
||||
return nil, fmt.Errorf("failed to dump request: %w", err)
|
||||
}
|
||||
|
||||
if _, err := t.writer.Write(in); err != nil {
|
||||
@@ -175,7 +175,7 @@ func (t DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
|
||||
out, err := httputil.DumpResponse(resp, true)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to dump response")
|
||||
return nil, fmt.Errorf("failed to dump response: %w", err)
|
||||
}
|
||||
|
||||
if _, err := t.writer.Write(out); err != nil {
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
gocontext "context"
|
||||
"encoding/csv"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -34,7 +35,6 @@ import (
|
||||
"github.com/containerd/containerd/oci"
|
||||
gocni "github.com/containerd/go-cni"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@@ -21,6 +21,7 @@ package run
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -39,7 +40,6 @@ import (
|
||||
"github.com/containerd/containerd/runtime/v2/runc/options"
|
||||
"github.com/containerd/containerd/snapshots"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@@ -204,7 +204,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
if context.Bool("net-host") {
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get hostname")
|
||||
return nil, fmt.Errorf("get hostname: %w", err)
|
||||
}
|
||||
opts = append(opts,
|
||||
oci.WithHostNamespace(specs.NetworkNamespace),
|
||||
@@ -417,15 +417,15 @@ func parseIDMapping(mapping string) (specs.LinuxIDMapping, error) {
|
||||
}
|
||||
cID, err := strconv.ParseUint(parts[0], 0, 32)
|
||||
if err != nil {
|
||||
return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid container id for user namespace remapping")
|
||||
return specs.LinuxIDMapping{}, fmt.Errorf("invalid container id for user namespace remapping: %w", err)
|
||||
}
|
||||
hID, err := strconv.ParseUint(parts[1], 0, 32)
|
||||
if err != nil {
|
||||
return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid host id for user namespace remapping")
|
||||
return specs.LinuxIDMapping{}, fmt.Errorf("invalid host id for user namespace remapping: %w", err)
|
||||
}
|
||||
size, err := strconv.ParseUint(parts[2], 0, 32)
|
||||
if err != nil {
|
||||
return specs.LinuxIDMapping{}, errors.Wrapf(err, "invalid size for user namespace remapping")
|
||||
return specs.LinuxIDMapping{}, fmt.Errorf("invalid size for user namespace remapping: %w", err)
|
||||
}
|
||||
return specs.LinuxIDMapping{
|
||||
ContainerID: uint32(cID),
|
||||
|
@@ -18,6 +18,7 @@ package run
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
|
||||
"github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"
|
||||
"github.com/containerd/console"
|
||||
@@ -26,7 +27,6 @@ import (
|
||||
"github.com/containerd/containerd/oci"
|
||||
"github.com/containerd/containerd/pkg/netns"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@@ -21,6 +21,7 @@ package shim
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
@@ -36,7 +37,6 @@ import (
|
||||
"github.com/containerd/typeurl"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@@ -18,6 +18,7 @@ package snapshots
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -35,7 +36,6 @@ import (
|
||||
"github.com/containerd/containerd/snapshots"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -262,7 +262,7 @@ var removeCommand = cli.Command{
|
||||
for _, key := range context.Args() {
|
||||
err = snapshotter.Remove(ctx, key)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to remove %q", key)
|
||||
return fmt.Errorf("failed to remove %q: %w", key, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
@@ -24,7 +25,6 @@ import (
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/runtime/linux/runctypes"
|
||||
"github.com/containerd/containerd/runtime/v2/runc/options"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@@ -17,10 +17,11 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
"github.com/moby/sys/signal"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@@ -17,13 +17,13 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
"github.com/containerd/typeurl"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@@ -17,11 +17,12 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cio"
|
||||
"github.com/containerd/containerd/cmd/ctr/commands"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@@ -21,6 +21,7 @@ package tasks
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -29,7 +30,6 @@ import (
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cio"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
@@ -18,6 +18,7 @@ package tasks
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"errors"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
@@ -25,7 +26,6 @@ import (
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cio"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user