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:
-rw-r--r--.golangci.yml1
-rw-r--r--packed_binaries.go14
2 files changed, 12 insertions, 3 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 17cad66ec..f97d22a09 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -64,7 +64,6 @@ linters-settings:
- (*io.PipeWriter).Close
- (*os.File).Close
- (io.Closer).Close
- - (io/fs.File).Close
- (net.Conn).Close
- (net.Listener).Close
forbidigo:
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