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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-08-11 09:53:41 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-09-23 10:02:55 +0300
commit9c4937daf01220a9fd99d67dd5b5d5d9df1e9954 (patch)
tree6963b82d63c5ba69b429aa9bfe6aa640a7af2af5
parent0e459e2167a73235f40f91d747039d7d9f2b0d33 (diff)
archive: Explicitly ignore error retruned by the tar writer
While we check error codes returned by the tar writer in the general case when writing an archive, we ignore it in case we have already seen an error in `TarBuilder.Close()`. We didn't explicitly ignore the error with a blanket-assignment though, and thus the errcheck linter complains. Fix this by assigning the error to the blanket variable and drop the corresponding exclude from our linting rules.
-rw-r--r--.golangci.yml1
-rw-r--r--internal/gitaly/archive/tar_builder.go2
2 files changed, 1 insertions, 2 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 7b874bd4a..a80d3f5fc 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -53,7 +53,6 @@ linters-settings:
# eventually fix.
exclude-functions:
# Close
- - (*archive/tar.Writer).Close
- (*compress/zlib.Writer).Close
- (*database/sql.DB).Close
- (*database/sql.Rows).Close
diff --git a/internal/gitaly/archive/tar_builder.go b/internal/gitaly/archive/tar_builder.go
index 2ae1a0b32..3e93e273e 100644
--- a/internal/gitaly/archive/tar_builder.go
+++ b/internal/gitaly/archive/tar_builder.go
@@ -196,7 +196,7 @@ func (t *TarBuilder) Close() error {
if t.err != nil {
// Ignore any close error in favour of reporting the previous one, but
// ensure the tar writer is closed to avoid resource leaks
- t.tarWriter.Close()
+ _ = t.tarWriter.Close()
return t.err
}