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

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2021-12-14 01:36:26 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2022-01-24 15:24:39 +0300
commit933c033f153891f5e338b8463b3b8f3c91d8885e (patch)
treeef7c6e74878a87df4449de897aa1fe1c845a51af /internal/vfs
parentc27b7ef86e28c9e97c5c655a958bdb733aca01eb (diff)
lint: fix errorlint issues
Diffstat (limited to 'internal/vfs')
-rw-r--r--internal/vfs/zip/archive.go7
-rw-r--r--internal/vfs/zip/vfs_test.go3
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go
index b773899c..c44f45ef 100644
--- a/internal/vfs/zip/archive.go
+++ b/internal/vfs/zip/archive.go
@@ -100,10 +100,9 @@ func (a *zipArchive) openArchive(parentCtx context.Context, url string) (err err
return a.err
case <-ctx.Done():
err := ctx.Err()
- switch err {
- case context.Canceled:
+ if errors.Is(err, context.Canceled) {
log.ContextLogger(parentCtx).WithError(err).Traceln("open zip archive request canceled")
- case context.DeadlineExceeded:
+ } else if errors.Is(err, context.DeadlineExceeded) {
log.ContextLogger(parentCtx).WithError(err).Traceln("open zip archive timed out")
}
@@ -264,7 +263,7 @@ func (a *zipArchive) Readlink(ctx context.Context, name string) (string, error)
// read up to len(symlink) bytes from the link file
n, err := io.ReadFull(rc, link[:])
- if err != nil && err != io.ErrUnexpectedEOF {
+ if err != nil && !errors.Is(err, io.ErrUnexpectedEOF) {
// if err == io.ErrUnexpectedEOF the link is smaller than len(symlink) so it's OK to not return it
return nil, err
}
diff --git a/internal/vfs/zip/vfs_test.go b/internal/vfs/zip/vfs_test.go
index 98660719..4de0240a 100644
--- a/internal/vfs/zip/vfs_test.go
+++ b/internal/vfs/zip/vfs_test.go
@@ -2,6 +2,7 @@ package zip
import (
"context"
+ "errors"
"io"
"io/fs"
"testing"
@@ -103,7 +104,7 @@ func TestVFSFindOrOpenArchiveConcurrentAccess(t *testing.T) {
require.Eventually(t, func() bool {
_, err := vfs.findOrOpenArchive(context.Background(), key, path)
- return err == errAlreadyCached
+ return errors.Is(err, errAlreadyCached)
}, 3*time.Second, time.Nanosecond)
}