Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 89d6401

Browse files
committed
Remove custom multierrors package
The hashicorp/go-multierror package provides functionality to do this. Replacing the custom package in favor of those (at the cost of some small duplication). Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 4464bb5 commit 89d6401

File tree

4 files changed

+5
-178
lines changed

4 files changed

+5
-178
lines changed

cli/cmd/context/rm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
"errors"
2222
"fmt"
2323

24+
"github.com/hashicorp/go-multierror"
2425
"github.com/spf13/cobra"
2526

2627
apicontext "github.com/docker/api/context"
2728
"github.com/docker/api/context/store"
28-
"github.com/docker/api/multierror"
2929
)
3030

3131
type removeOpts struct {
@@ -58,12 +58,12 @@ func runRemove(ctx context.Context, args []string, force bool) error {
5858
if force {
5959
err := runUse(ctx, "default")
6060
if err != nil {
61-
errs = multierror.Append(errs, errors.New("cannot delete current context"))
61+
errs = multierror.Append(errs, multierror.Prefix(errors.New("cannot delete current context"), "Error:"))
6262
} else {
6363
errs = removeContext(s, contextName, errs)
6464
}
6565
} else {
66-
errs = multierror.Append(errs, errors.New("cannot delete current context"))
66+
errs = multierror.Append(errs, multierror.Prefix(errors.New("cannot delete current context"), "Error:"))
6767
}
6868
} else {
6969
errs = removeContext(s, contextName, errs)

cli/cmd/rm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"context"
2121
"fmt"
2222

23+
"github.com/hashicorp/go-multierror"
2324
"github.com/pkg/errors"
2425
"github.com/spf13/cobra"
2526

2627
"github.com/docker/api/client"
27-
"github.com/docker/api/multierror"
2828
)
2929

3030
type rmOpts struct {
@@ -59,7 +59,7 @@ func runRm(ctx context.Context, args []string, opts rmOpts) error {
5959
for _, id := range args {
6060
err := c.ContainerService().Delete(ctx, id, opts.force)
6161
if err != nil {
62-
errs = multierror.Append(errs, err)
62+
errs = multierror.Append(errs, multierror.Prefix(err, "Error:"))
6363
continue
6464
}
6565
fmt.Println(id)

multierror/multierror.go

Lines changed: 0 additions & 108 deletions
This file was deleted.

multierror/multierror_test.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)