diff --git a/cli/command/system/dial_stdio.go b/cli/command/system/dial_stdio.go index 13596acd62..62206af0ed 100644 --- a/cli/command/system/dial_stdio.go +++ b/cli/command/system/dial_stdio.go @@ -2,12 +2,13 @@ package system import ( "context" + "errors" + "fmt" "io" "os" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -35,7 +36,7 @@ func runDialStdio(ctx context.Context, dockerCli command.Cli) error { dialer := dockerCli.Client().Dialer() conn, err := dialer(ctx) if err != nil { - return errors.Wrap(err, "failed to open the raw stream connection") + return fmt.Errorf("failed to open the raw stream connection: %w", err) } defer conn.Close() @@ -81,7 +82,7 @@ func copier(to halfWriteCloser, from halfReadCloser, debugDescription string) er } }() if _, err := io.Copy(to, from); err != nil { - return errors.Wrapf(err, "error while Copy (%s)", debugDescription) + return fmt.Errorf("error while Copy (%s): %w", debugDescription, err) } return nil } diff --git a/cli/command/system/inspect.go b/cli/command/system/inspect.go index 7f6a965233..6717747887 100644 --- a/cli/command/system/inspect.go +++ b/cli/command/system/inspect.go @@ -17,7 +17,6 @@ import ( flagsHelper "github.com/docker/cli/cli/flags" "github.com/moby/moby/api/types/image" "github.com/moby/moby/client" - "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -99,7 +98,7 @@ func runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions) typePlugin, typeSecret, typeService, typeTask, typeVolume: elementSearcher = inspectAll(ctx, dockerCli, opts.size, opts.objectType) default: - return errors.Errorf(`unknown type: %q: must be one of "%s"`, opts.objectType, strings.Join(allTypes, `", "`)) + return fmt.Errorf(`unknown type: %q: must be one of "%s"`, opts.objectType, strings.Join(allTypes, `", "`)) } return inspect.Inspect(dockerCli.Out(), opts.ids, opts.format, elementSearcher) } @@ -273,7 +272,7 @@ func inspectAll(ctx context.Context, dockerCLI command.Cli, getSize bool, typeCo } return v, raw, err } - return nil, nil, errors.Errorf("error: no such object: %s", ref) + return nil, nil, fmt.Errorf("error: no such object: %s", ref) } } diff --git a/cli/command/system/version.go b/cli/command/system/version.go index 309bda941e..5f5937c59a 100644 --- a/cli/command/system/version.go +++ b/cli/command/system/version.go @@ -2,6 +2,7 @@ package system import ( "context" + "fmt" "io" "runtime" "sort" @@ -18,7 +19,6 @@ import ( "github.com/docker/cli/templates" "github.com/moby/moby/api/types" "github.com/moby/moby/client" - "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/tonistiigi/go-rosetta" ) @@ -212,7 +212,7 @@ func newVersionTemplate(templateFormat string) (*template.Template, error) { } tmpl, err := templates.New("version").Funcs(template.FuncMap{"getDetailsOrder": getDetailsOrder}).Parse(templateFormat) if err != nil { - return nil, errors.Wrap(err, "template parsing error") + return nil, fmt.Errorf("template parsing error: %w", err) } return tmpl, nil }