Skip to content

Commit

Permalink
Remove unnecessary error handling
Browse files Browse the repository at this point in the history
A function in the reset code does not return an error.  Simply removing the error variable and check for the condition (which was always false or nil)

Signed-off-by: Brent Baude <[email protected]>
  • Loading branch information
baude committed Jan 27, 2025
1 parent f11dde7 commit 89814fb
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions cmd/podman/machine/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,8 @@ func init() {
}

func reset(_ *cobra.Command, _ []string) error {
var (
err error
)

providers := provider2.GetAll()
if err != nil {
return err
}
for _, p := range providers {
allProviders := provider2.GetAll()
for _, p := range allProviders {
hasPerms := provider2.HasPermsForProvider(p.VMType())
isInstalled, err := provider2.IsInstalled(p.VMType())
if !hasPerms && (isInstalled || err != nil) && !resetOptions.Force {
Expand All @@ -65,7 +58,7 @@ func reset(_ *cobra.Command, _ []string) error {
}

if !resetOptions.Force {
listResponse, err := shim.List(providers, machine.ListOptions{})
listResponse, err := shim.List(allProviders, machine.ListOptions{})
if err != nil {
return err
}
Expand All @@ -82,7 +75,7 @@ func reset(_ *cobra.Command, _ []string) error {
return nil
}
}
return shim.Reset(providers, resetOptions)
return shim.Reset(allProviders, resetOptions)
}

func resetConfirmationMessage(listResponse []*machine.ListResponse) {
Expand Down

0 comments on commit 89814fb

Please sign in to comment.