Skip to content

Commit

Permalink
👷 v3 (ci): fix some linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed Mar 6, 2023
1 parent 3168a60 commit 41866cd
Show file tree
Hide file tree
Showing 32 changed files with 237 additions and 143 deletions.
4 changes: 3 additions & 1 deletion addon/retry/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package retry

import "time"
import (
"time"
)

// Config defines the config for addon.
type Config struct {
Expand Down
9 changes: 6 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ func (app *App) Config() Config {
func (app *App) Handler() fasthttp.RequestHandler { //revive:disable-line:confusing-naming // Having both a Handler() (uppercase) and a handler() (lowercase) is fine. TODO: Use nolint:revive directive instead. See https://github.com/golangci/golangci-lint/issues/3476
// prepare the server for the start
app.startupProcess()
return app.handler
return app.requestHandler
}

// Stack returns the raw router stack.
Expand Down Expand Up @@ -981,7 +981,7 @@ func (app *App) init() *App {
}

// fasthttp server settings
app.server.Handler = app.handler
app.server.Handler = app.requestHandler
app.server.Name = app.config.ServerHeader
app.server.Concurrency = app.config.Concurrency
app.server.NoDefaultDate = app.config.DisableDefaultDate
Expand Down Expand Up @@ -1041,7 +1041,10 @@ func (app *App) ErrorHandler(ctx Ctx, err error) error {
// errors before calling the application's error handler method.
func (app *App) serverErrorHandler(fctx *fasthttp.RequestCtx, err error) {
// Acquire Ctx with fasthttp request from pool
c := app.AcquireCtx().(*DefaultCtx)
c, ok := app.AcquireCtx().(*DefaultCtx)
if !ok {
panic(fmt.Errorf("failed to type-assert to *DefaultCtx"))
}
c.Reset(fctx)

defer app.ReleaseCtx(c)
Expand Down
4 changes: 2 additions & 2 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func Test_App_serverErrorHandler_Internal_Error(t *testing.T) {
t.Parallel()
app := New()
msg := "test err"
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx)
c := app.NewCtx(&fasthttp.RequestCtx{}).(*DefaultCtx) //nolint:errcheck, forcetypeassert // not needed

app.serverErrorHandler(c.fasthttp, errors.New(msg))
require.Equal(t, string(c.fasthttp.Response.Body()), msg)
Expand Down Expand Up @@ -1294,7 +1294,7 @@ func Benchmark_AcquireCtx(b *testing.B) {
// go test -v -run=^$ -bench=Benchmark_NewError -benchmem -count=4
func Benchmark_NewError(b *testing.B) {
for n := 0; n < b.N; n++ {
NewError(200, "test")
NewError(200, "test") //nolint:errcheck // not needed
}
}

Expand Down
Loading

0 comments on commit 41866cd

Please sign in to comment.