Skip to content

Commit 0d78d2a

Browse files
JoshVanLacroca
andauthored
Apply suggestion from @acroca
Co-authored-by: Albert Callarisa <[email protected]> Signed-off-by: Josh van Leeuwen <[email protected]>
1 parent 768f237 commit 0d78d2a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/scheduler/exportimport.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,13 @@ func Export(ctx context.Context, opts ExportImportOptions) error {
8686
if err != nil {
8787
return fmt.Errorf("open %s: %w", opts.TargetFile, err)
8888
}
89+
defer f.Close()
8990

9091
if err := gob.NewEncoder(f).Encode(&out); err != nil {
91-
_ = f.Close()
9292
_ = os.Remove(opts.TargetFile)
9393
return fmt.Errorf("encode export file: %w", err)
9494
}
9595

96-
f.Close()
9796
print.InfoStatusEvent(os.Stdout, "Exported %d jobs and %d counters.", len(out.Jobs), len(out.Counters))
9897
return nil
9998
}

0 commit comments

Comments
 (0)