Skip to content

Commit 5df0244

Browse files
committed
cli/command/containers: runUpdate: use native errors.Join
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 935df8a commit 5df0244

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

cli/command/container/update.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package container
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"strings"
78

@@ -10,7 +11,6 @@ import (
1011
"github.com/docker/cli/cli/command/completion"
1112
"github.com/docker/cli/opts"
1213
containertypes "github.com/moby/moby/api/types/container"
13-
"github.com/pkg/errors"
1414
"github.com/spf13/cobra"
1515
)
1616

@@ -131,12 +131,12 @@ func runUpdate(ctx context.Context, dockerCli command.Cli, options *updateOption
131131

132132
var (
133133
warns []string
134-
errs []string
134+
errs []error
135135
)
136136
for _, ctr := range options.containers {
137137
r, err := dockerCli.Client().ContainerUpdate(ctx, ctr, updateConfig)
138138
if err != nil {
139-
errs = append(errs, err.Error())
139+
errs = append(errs, err)
140140
} else {
141141
_, _ = fmt.Fprintln(dockerCli.Out(), ctr)
142142
}
@@ -145,8 +145,5 @@ func runUpdate(ctx context.Context, dockerCli command.Cli, options *updateOption
145145
if len(warns) > 0 {
146146
_, _ = fmt.Fprintln(dockerCli.Out(), strings.Join(warns, "\n"))
147147
}
148-
if len(errs) > 0 {
149-
return errors.New(strings.Join(errs, "\n"))
150-
}
151-
return nil
148+
return errors.Join(errs...)
152149
}

0 commit comments

Comments
 (0)