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-21 17:25:26 +0300
commit02f27232d081366e17ddcce19394966963e7b7e7 (patch)
treee4619ba9c76d86c15bcddaba34e4b42bbd830737
parenta8a88ef9286a0aca256ab9fbbef4a5c4199aa315 (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
}