Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'packed_binaries.go')
-rw-r--r--packed_binaries.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/packed_binaries.go b/packed_binaries.go
index fe3e435e0..6b0774988 100644
--- a/packed_binaries.go
+++ b/packed_binaries.go
@@ -40,14 +40,20 @@ func UnpackAuxiliaryBinaries(destinationDir string) error {
if err != nil {
return fmt.Errorf("open packed binary %q: %w", packedPath, err)
}
- defer packedFile.Close()
+ defer func() {
+ // We already check the error below.
+ _ = packedFile.Close()
+ }()
unpackedPath := filepath.Join(destinationDir, entry.Name())
unpackedFile, err := os.OpenFile(unpackedPath, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o700)
if err != nil {
return err
}
- defer unpackedFile.Close()
+ defer func() {
+ // We already check the error below.
+ _ = unpackedFile.Close()
+ }()
if _, err := io.Copy(unpackedFile, packedFile); err != nil {
return fmt.Errorf("unpack %q: %w", unpackedPath, err)
@@ -57,6 +63,10 @@ func UnpackAuxiliaryBinaries(destinationDir string) error {
return fmt.Errorf("close %q: %w", unpackedPath, err)
}
+ if err := packedFile.Close(); err != nil {
+ return fmt.Errorf("close packed file %q: %w", packedPath, err)
+ }
+
return nil
}(); err != nil {
return err