Check returned error values

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-08-25 16:48:11 +02:00
parent e0df157f70
commit 8a9f367067
10 changed files with 37 additions and 15 deletions

View File

@@ -119,10 +119,10 @@ func run(c *cli.Context, opts *options) error {
}
defer output.Close()
if err != nil {
return err
if _, err := cfgToml.Save(output); err != nil {
return fmt.Errorf("failed to save config: %v", err)
}
cfgToml.Save(output)
return nil
}

View File

@@ -85,8 +85,7 @@ func (m command) run(c *cli.Context, opts *flags.Options) error {
}
defer output.Close()
_, err = cfgToml.Save(output)
if err != nil {
if _, err = cfgToml.Save(output); err != nil {
return fmt.Errorf("failed to write output: %v", err)
}