Skip to content

Commit ba321bf

Browse files
Potential fix for pull request finding 'Writable file handle closed without error handling'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent 8647722 commit ba321bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

go/cmd/bundler/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,9 @@ func extractFileFromTarball(tarballPath, destDir, targetPath, outputName string)
529529
}
530530

531531
if _, err := io.Copy(outFile, tarReader); err != nil {
532-
outFile.Close()
532+
if cerr := outFile.Close(); cerr != nil {
533+
return fmt.Errorf("failed to extract binary (copy error: %v, close error: %v)", err, cerr)
534+
}
533535
return fmt.Errorf("failed to extract binary: %w", err)
534536
}
535537
if err := outFile.Close(); err != nil {

0 commit comments

Comments
 (0)