From 8ecfc989d9c4c6c30232a6465ec17d5c6d85fc5f Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Sun, 12 Nov 2023 17:42:39 +0200 Subject: [PATCH] Enable dupword, unconvert linters (#1658) --- .golangci.yml | 2 -- bytesconv_test.go | 2 +- client.go | 1 + fs.go | 4 ++-- http_test.go | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 483c67ad5e..ad75ddf96d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,7 +11,6 @@ linters: - cyclop - depguard - dupl - - dupword - errname - errorlint - exhaustive @@ -43,7 +42,6 @@ linters: - testpackage - thelper - tparallel - - unconvert - unparam - usestdlibvars - varnamelen diff --git a/bytesconv_test.go b/bytesconv_test.go index c9034ec0e5..444981061a 100644 --- a/bytesconv_test.go +++ b/bytesconv_test.go @@ -37,7 +37,7 @@ func TestAppendHTMLEscape(t *testing.T) { allcases[i] = byte(i) } res := string(AppendHTMLEscape(nil, string(allcases))) - expect := string(html.EscapeString(string(allcases))) + expect := html.EscapeString(string(allcases)) if res != expect { t.Fatalf("unexpected string %q. Expecting %q.", res, expect) } diff --git a/client.go b/client.go index c5251e1225..498de057c7 100644 --- a/client.go +++ b/client.go @@ -1474,6 +1474,7 @@ func (c *HostClient) acquireConn(reqTimeout time.Duration, connectionClose bool) return nil, ErrNoFreeConns } + //nolint:dupword // reqTimeout c.MaxConnWaitTimeout wait duration // d1 d2 min(d1, d2) // 0(not set) d2 d2 diff --git a/fs.go b/fs.go index 9ada758843..c231d8031c 100644 --- a/fs.go +++ b/fs.go @@ -870,7 +870,7 @@ func (cm *inMemoryCacheManager) GetFileFromCache(cacheKind CacheKind, path strin fileCache := cm.getFsCache(cacheKind) cm.cacheLock.Lock() - ff, ok := fileCache[string(path)] + ff, ok := fileCache[path] if ok { ff.readersCount++ } @@ -1594,7 +1594,7 @@ func (h *fsHandler) newFSFile(f fs.File, fileInfo fs.FileInfo, compressed bool, } func readFileHeader(f io.Reader, compressed bool, fileEncoding string) ([]byte, error) { - r := io.Reader(f) + r := f var ( br *brotli.Reader zr *gzip.Reader diff --git a/http_test.go b/http_test.go index 0091566c7a..7b526cbd85 100644 --- a/http_test.go +++ b/http_test.go @@ -3022,7 +3022,7 @@ func TestResponseBodyStream(t *testing.T) { } }) - t.Run("limit response body size size", func(t *testing.T) { + t.Run("limit response body size", func(t *testing.T) { t.Parallel() client := Client{StreamResponseBody: true, MaxResponseBodySize: 20}