Skip to content

Commit 4245fee

Browse files
committed
Don't ignore error returned by Templates()
Signed-off-by: Jan Dubois <[email protected]>
1 parent 2f1b939 commit 4245fee

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

cmd/limactl/start.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,18 @@ func createStartActionCommon(cmd *cobra.Command, _ []string) (exit bool, err err
371371
if listTemplates, err := cmd.Flags().GetBool("list-templates"); err != nil {
372372
return true, err
373373
} else if listTemplates {
374-
if templates, err := templatestore.Templates(); err == nil {
375-
w := cmd.OutOrStdout()
376-
for _, f := range templates {
377-
// Don't show internal base templates like `_default/*` and `_images/*`.
378-
if !strings.HasPrefix(f.Name, "_") {
379-
_, _ = fmt.Fprintln(w, f.Name)
380-
}
374+
templates, err := templatestore.Templates()
375+
if err != nil {
376+
return true, err
377+
}
378+
w := cmd.OutOrStdout()
379+
for _, f := range templates {
380+
// Don't show internal base templates like `_default/*` and `_images/*`.
381+
if !strings.HasPrefix(f.Name, "_") {
382+
_, _ = fmt.Fprintln(w, f.Name)
381383
}
382-
return true, nil
383384
}
385+
return true, nil
384386
}
385387
return false, nil
386388
}

0 commit comments

Comments
 (0)