From 32090523055a87f7471cbc27338b187e5c03bbd7 Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> Date: Sun, 24 Mar 2024 15:32:13 -0400 Subject: [PATCH] chore: Update golangci-lint to v1.57.1 (#2929) * Update linter.yml * Fix issues from golangci-lint v1.57.1 --- .github/workflows/linter.yml | 2 +- .golangci.yml | 7 +++---- client/core_test.go | 18 +++++++++--------- client/helper_test.go | 4 ++-- client/request_test.go | 6 +++--- listen_test.go | 1 - redirect_test.go | 1 - 7 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 6a4c3475a1..10c05f26b1 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -33,4 +33,4 @@ jobs: uses: golangci/golangci-lint-action@v4 with: # NOTE: Keep this in sync with the version from .golangci.yml - version: v1.56.2 + version: v1.57.1 diff --git a/.golangci.yml b/.golangci.yml index b09d48e760..98a9cc0a4a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,12 +1,9 @@ -# v1.2.0. Created based on golangci-lint v1.56.2 +# v1.2.0. Created based on golangci-lint v1.57.1 run: timeout: 5m - skip-dirs-use-default: false modules-download-mode: readonly allow-serial-runners: true - skip-dirs: - - internal # TODO: Do not ignore interal output: sort-results: true @@ -255,6 +252,8 @@ issues: exclude-case-sensitive: true max-issues-per-linter: 0 max-same-issues: 0 + exclude-dirs: + - internal # TODO: Do not ignore interal packages exclude-rules: - linters: - goerr113 diff --git a/client/core_test.go b/client/core_test.go index b54071da1b..c985784c22 100644 --- a/client/core_test.go +++ b/client/core_test.go @@ -88,7 +88,7 @@ func Test_Exec_Func(t *testing.T) { core.client = client core.req = req - client.SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) //nolint:wrapcheck // not needed + client.SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) req.RawRequest.SetRequestURI("http://example.com/normal") resp, err := core.execFunc() @@ -104,7 +104,7 @@ func Test_Exec_Func(t *testing.T) { core.client = client core.req = req - client.SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) //nolint:wrapcheck // not needed + client.SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) req.RawRequest.SetRequestURI("http://example.com/return-error") resp, err := core.execFunc() @@ -124,7 +124,7 @@ func Test_Exec_Func(t *testing.T) { core.client = client core.req = req - client.SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) //nolint:wrapcheck // not needed + client.SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) req.RawRequest.SetRequestURI("http://example.com/hang-up") _, err := core.execFunc() @@ -163,7 +163,7 @@ func Test_Execute(t *testing.T) { return nil }) client.SetDial(func(_ string) (net.Conn, error) { - return ln.Dial() //nolint:wrapcheck // not needed + return ln.Dial() }) req.SetURL("http://example.com") @@ -180,7 +180,7 @@ func Test_Execute(t *testing.T) { return nil }) client.SetDial(func(_ string) (net.Conn, error) { - return ln.Dial() //nolint:wrapcheck // not needed + return ln.Dial() }) req.SetURL("http://example.com") @@ -194,7 +194,7 @@ func Test_Execute(t *testing.T) { core, client, req := newCore(), New(), AcquireRequest() client.SetDial(func(_ string) (net.Conn, error) { - return ln.Dial() //nolint:wrapcheck // not needed + return ln.Dial() }) req.SetURL("http://example.com/hang-up") @@ -208,7 +208,7 @@ func Test_Execute(t *testing.T) { core, client, req := newCore(), New(), AcquireRequest() client.SetTimeout(500 * time.Millisecond) client.SetDial(func(_ string) (net.Conn, error) { - return ln.Dial() //nolint:wrapcheck // not needed + return ln.Dial() }) req.SetURL("http://example.com/hang-up") @@ -221,7 +221,7 @@ func Test_Execute(t *testing.T) { core, client, req := newCore(), New(), AcquireRequest() client.SetDial(func(_ string) (net.Conn, error) { - return ln.Dial() //nolint:wrapcheck // not needed + return ln.Dial() }) req.SetURL("http://example.com/hang-up"). SetTimeout(300 * time.Millisecond) @@ -236,7 +236,7 @@ func Test_Execute(t *testing.T) { client.SetTimeout(30 * time.Millisecond) client.SetDial(func(_ string) (net.Conn, error) { - return ln.Dial() //nolint:wrapcheck // not needed + return ln.Dial() }) req.SetURL("http://example.com/hang-up"). SetTimeout(3000 * time.Millisecond) diff --git a/client/helper_test.go b/client/helper_test.go index 7343fa972f..f25d0af123 100644 --- a/client/helper_test.go +++ b/client/helper_test.go @@ -62,7 +62,7 @@ func (ts *testServer) dial() func(addr string) (net.Conn, error) { ts.tb.Helper() return func(_ string) (net.Conn, error) { - return ts.ln.Dial() //nolint:wrapcheck // not needed + return ts.ln.Dial() } } @@ -74,7 +74,7 @@ func createHelperServer(tb testing.TB) (*fiber.App, func(addr string) (net.Conn, app := fiber.New() return app, func(_ string) (net.Conn, error) { - return ln.Dial() //nolint:wrapcheck // not needed + return ln.Dial() }, func() { require.NoError(tb, app.Listener(ln, fiber.ListenConfig{DisableStartupMessage: true})) } diff --git a/client/request_test.go b/client/request_test.go index d0348bfeb4..e5369fbbaf 100644 --- a/client/request_test.go +++ b/client/request_test.go @@ -1251,7 +1251,7 @@ func Test_Request_MaxRedirects(t *testing.T) { t.Run("success", func(t *testing.T) { t.Parallel() - client := New().SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) //nolint:wrapcheck // not needed + client := New().SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) resp, err := AcquireRequest(). SetClient(client). @@ -1270,7 +1270,7 @@ func Test_Request_MaxRedirects(t *testing.T) { t.Run("error", func(t *testing.T) { t.Parallel() - client := New().SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) //nolint:wrapcheck // not needed + client := New().SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) resp, err := AcquireRequest(). SetClient(client). @@ -1284,7 +1284,7 @@ func Test_Request_MaxRedirects(t *testing.T) { t.Run("MaxRedirects", func(t *testing.T) { t.Parallel() - client := New().SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) //nolint:wrapcheck // not needed + client := New().SetDial(func(_ string) (net.Conn, error) { return ln.Dial() }) req := AcquireRequest(). SetClient(client). diff --git a/listen_test.go b/listen_test.go index b8d249f431..da60aa75e9 100644 --- a/listen_test.go +++ b/listen_test.go @@ -1,4 +1,3 @@ -//nolint:wrapcheck // We must not wrap errors in tests package fiber import ( diff --git a/redirect_test.go b/redirect_test.go index a77bfbc4ec..dd5e4b2715 100644 --- a/redirect_test.go +++ b/redirect_test.go @@ -2,7 +2,6 @@ // 📝 Github Repository: https://github.com/gofiber/fiber // 📌 API Documentation: https://docs.gofiber.io -//nolint:wrapcheck // We must not wrap errors in tests package fiber import (