Skip to content

Commit

Permalink
[eclipse-kanto#210] Fixed lint suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-milchev committed Nov 22, 2023
1 parent 473f3e2 commit 54039ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
22 changes: 11 additions & 11 deletions containerm/cli/cli_command_ctrs_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ func (cc *removeCmd) run(args []string) error {
return err
}
return cc.cli.gwManClient.Remove(ctx, ctr.ID, cc.config.force)
} else {
for _, arg := range args {
ctr, err = utilcli.ValidateContainerByNameArgsSingle(ctx, []string{arg}, cc.config.name, cc.cli.gwManClient)
if err == nil {
if err = cc.cli.gwManClient.Remove(ctx, ctr.ID, cc.config.force); err != nil {
errs.Append(err)
}
} else {
}
for _, arg := range args {
ctr, err = utilcli.ValidateContainerByNameArgsSingle(ctx, []string{arg}, cc.config.name, cc.cli.gwManClient)
if err == nil {
if err = cc.cli.gwManClient.Remove(ctx, ctr.ID, cc.config.force); err != nil {
errs.Append(err)
}
}
if errs.Size() > 0 {
return errors.New(errs.ErrorWithMessage("containers couldn't be removed due to the following reasons: "))
} else {
errs.Append(err)
}
}
if errs.Size() > 0 {
return errors.New(errs.ErrorWithMessage("containers couldn't be removed due to the following reasons: "))
}

return nil
}

Expand Down
1 change: 1 addition & 0 deletions containerm/util/error/error_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (m *CompoundError) Error() string {
return m.ErrorWithMessage(fmt.Sprintf("%d errors:", len(m.errs)))
}

// ErrorWithMessage returns combined error messages with a custom message.
func (m *CompoundError) ErrorWithMessage(message string) string {
if len(m.errs) == 0 {
return fmt.Sprintf("no error")
Expand Down

0 comments on commit 54039ca

Please sign in to comment.