diff --git a/cmd/archive.go b/cmd/archive.go index d17096c0fd87..86e694757cd4 100644 --- a/cmd/archive.go +++ b/cmd/archive.go @@ -105,6 +105,12 @@ An archive is a fully self-contained test run, and can be executed identically e if err != nil { return err } + defer func() { //nolint:gosec + cerr := f.Close() + if err == nil && cerr != nil { + err = cerr + } + }() return arc.Write(f) }, }