Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golangci-lint to v1.56.1 #2842

Merged
merged 12 commits into from
Feb 13, 2024
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# NOTE: Keep this in sync with the version from .golangci.yml
version: v1.55.2
version: v1.56.1
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ output:
sort-results: true

linters-settings:
testifylint:
enable-all: true
disable:
- go-require
ReneWerner87 marked this conversation as resolved.
Show resolved Hide resolved
errcheck:
check-type-assertions: true
check-blank: true
Expand Down Expand Up @@ -159,6 +163,8 @@ issues:
exclude-use-default: false

linters:
disable:
- spancheck
enable:
- asasalint
- asciicheck
Expand Down
18 changes: 9 additions & 9 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func Test_App_ServerErrorHandler_SmallReadBuffer(t *testing.T) {
)
app := New()

app.Get("/", func(c Ctx) error {
app.Get("/", func(_ Ctx) error {
panic(errors.New("should never called"))
})

Expand All @@ -160,7 +160,7 @@ func Test_App_Errors(t *testing.T) {
BodyLimit: 4,
})

app.Get("/", func(c Ctx) error {
app.Get("/", func(_ Ctx) error {
return errors.New("hi, i'm an error")
})

Expand Down Expand Up @@ -236,12 +236,12 @@ func Test_App_CustomConstraint(t *testing.T) {
func Test_App_ErrorHandler_Custom(t *testing.T) {
t.Parallel()
app := New(Config{
ErrorHandler: func(c Ctx, err error) error {
ErrorHandler: func(c Ctx, _ error) error {
return c.Status(200).SendString("hi, i'm an custom error")
},
})

app.Get("/", func(c Ctx) error {
app.Get("/", func(_ Ctx) error {
return errors.New("hi, i'm an error")
})

Expand Down Expand Up @@ -271,7 +271,7 @@ func Test_App_ErrorHandler_HandlerStack(t *testing.T) {
require.Equal(t, "0: GET error", err.Error())
return errors.New("2: USE error")
})
app.Get("/", func(c Ctx) error {
app.Get("/", func(_ Ctx) error {
return errors.New("0: GET error")
})

Expand All @@ -297,7 +297,7 @@ func Test_App_ErrorHandler_RouteStack(t *testing.T) {
require.Equal(t, "0: GET error", err.Error())
return errors.New("1: USE error") // [2] call ErrorHandler
})
app.Get("/test", func(c Ctx) error {
app.Get("/test", func(_ Ctx) error {
return errors.New("0: GET error") // [1] return to USE
})

Expand Down Expand Up @@ -1433,7 +1433,7 @@ func Test_Test_Timeout(t *testing.T) {
require.NoError(t, err, "app.Test(req)")
require.Equal(t, 200, resp.StatusCode, "Status code")

app.Get("timeout", func(c Ctx) error {
app.Get("timeout", func(_ Ctx) error {
time.Sleep(200 * time.Millisecond)
return nil
})
Expand Down Expand Up @@ -1633,7 +1633,7 @@ func Test_App_Server(t *testing.T) {

func Test_App_Error_In_Fasthttp_Server(t *testing.T) {
app := New()
app.config.ErrorHandler = func(c Ctx, err error) error {
app.config.ErrorHandler = func(_ Ctx, _ error) error {
return errors.New("fake error")
}
app.server.GetOnly = true
Expand Down Expand Up @@ -1731,7 +1731,7 @@ func Test_App_Test_no_timeout_infinitely(t *testing.T) {
go func() {
defer func() { c <- 0 }()
app := New()
app.Get("/", func(c Ctx) error {
app.Get("/", func(_ Ctx) error {
runtime.Goexit()
return nil
})
Expand Down
52 changes: 26 additions & 26 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func Test_Client_Invalid_URL(t *testing.T) {

a := Get("http://example.com\r\n\r\nGET /\r\n\r\n")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

_, body, errs := a.String()

Expand Down Expand Up @@ -86,7 +86,7 @@ func Test_Client_Get(t *testing.T) {
for i := 0; i < 5; i++ {
a := Get("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -115,7 +115,7 @@ func Test_Client_Head(t *testing.T) {
for i := 0; i < 5; i++ {
a := Head("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -151,7 +151,7 @@ func Test_Client_Post(t *testing.T) {
a := Post("http://example.com").
Form(args)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -188,7 +188,7 @@ func Test_Client_Put(t *testing.T) {
a := Put("http://example.com").
Form(args)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -225,7 +225,7 @@ func Test_Client_Patch(t *testing.T) {
a := Patch("http://example.com").
Form(args)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -260,7 +260,7 @@ func Test_Client_Delete(t *testing.T) {

a := Delete("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -294,7 +294,7 @@ func Test_Client_UserAgent(t *testing.T) {
for i := 0; i < 5; i++ {
a := Get("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand All @@ -312,7 +312,7 @@ func Test_Client_UserAgent(t *testing.T) {

a := c.Get("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -451,7 +451,7 @@ func Test_Client_Agent_Host(t *testing.T) {

require.Equal(t, "1.1.1.1:8080", a.HostClient.Addr)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -560,7 +560,7 @@ func Test_Client_Agent_Custom_Response(t *testing.T) {

require.NoError(t, a.Parse())

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.SetResponse(resp).
String()
Expand Down Expand Up @@ -597,7 +597,7 @@ func Test_Client_Agent_Dest(t *testing.T) {

a := Get("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.Dest(dest[:0]).String()

Expand All @@ -613,7 +613,7 @@ func Test_Client_Agent_Dest(t *testing.T) {

a := Get("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.Dest(dest[:0]).String()

Expand Down Expand Up @@ -671,11 +671,11 @@ func Test_Client_Agent_RetryIf(t *testing.T) {
}()

a := Post("http://example.com").
RetryIf(func(req *Request) bool {
RetryIf(func(_ *Request) bool {
return true
})
dialsCount := 0
a.HostClient.Dial = func(addr string) (net.Conn, error) {
a.HostClient.Dial = func(_ string) (net.Conn, error) {
dialsCount++
switch dialsCount {
case 1:
Expand Down Expand Up @@ -819,7 +819,7 @@ func Test_Client_Agent_MultipartForm(t *testing.T) {
Boundary("myBoundary").
MultipartForm(args)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -900,7 +900,7 @@ func Test_Client_Agent_MultipartForm_SendFiles(t *testing.T) {
SendFiles(".github/testdata/index.html", "index", ".github/testdata/index.tmpl").
MultipartForm(nil)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -1010,7 +1010,7 @@ func Test_Client_Agent_Timeout(t *testing.T) {
a := Get("http://example.com").
Timeout(time.Millisecond * 50)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

_, body, errs := a.String()

Expand Down Expand Up @@ -1039,7 +1039,7 @@ func Test_Client_Agent_Reuse(t *testing.T) {
a := Get("http://example.com").
Reuse()

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down Expand Up @@ -1152,7 +1152,7 @@ func Test_Client_Agent_MaxRedirectsCount(t *testing.T) {
a := Get("http://example.com?foo").
MaxRedirectsCount(1)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand All @@ -1166,7 +1166,7 @@ func Test_Client_Agent_MaxRedirectsCount(t *testing.T) {
a := Get("http://example.com").
MaxRedirectsCount(1)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

_, body, errs := a.String()

Expand Down Expand Up @@ -1202,7 +1202,7 @@ func Test_Client_Agent_Struct(t *testing.T) {

a := Get("http://example.com")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

var d data

Expand All @@ -1220,7 +1220,7 @@ func Test_Client_Agent_Struct(t *testing.T) {

errPre := errors.New("pre errors")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }
a.errs = append(a.errs, errPre)

var d data
Expand All @@ -1236,7 +1236,7 @@ func Test_Client_Agent_Struct(t *testing.T) {
t.Parallel()
a := Get("http://example.com/error")

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

var d data

Expand All @@ -1260,7 +1260,7 @@ func Test_Client_Agent_Struct(t *testing.T) {
request.SetRequestURI("http://example.com")
err := a.Parse()
require.NoError(t, err)
a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }
var d data
code, body, errs := a.Struct(&d)
require.Equal(t, StatusOK, code)
Expand Down Expand Up @@ -1303,7 +1303,7 @@ func testAgent(t *testing.T, handler Handler, wrapAgent func(agent *Agent), exce

wrapAgent(a)

a.HostClient.Dial = func(addr string) (net.Conn, error) { return ln.Dial() }
a.HostClient.Dial = func(_ string) (net.Conn, error) { return ln.Dial() }

code, body, errs := a.String()

Expand Down
2 changes: 1 addition & 1 deletion ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (c *DefaultCtx) ClearCookie(key ...string) {
}
return
}
c.fasthttp.Request.Header.VisitAllCookie(func(k, v []byte) {
c.fasthttp.Request.Header.VisitAllCookie(func(k, _ []byte) {
c.fasthttp.Response.Header.DelClientCookieBytes(k)
})
}
Expand Down
Loading
Loading