only overwrite err with closeErr if err is nil and closeErr is non nil

This commit is contained in:
alex.schade 2022-02-15 07:34:01 -08:00
parent 1fc6c8e049
commit 354ef1d29e
No known key found for this signature in database
GPG Key ID: 94693A2873189850
1 changed files with 1 additions and 1 deletions

View File

@ -332,7 +332,7 @@ func hashZip(mod module.Version, zipfile, ziphashfile string) (err error) {
return err
}
defer func() {
if closeErr := hf.Close(); err != nil {
if closeErr := hf.Close(); err == nil && closeErr != nil {
err = closeErr
}
}()