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

Fix loop variable captured by func literal #2660

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions middleware/compress/compress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func Test_Compress_Different_Level(t *testing.T) {
t.Parallel()
levels := []Level{LevelBestSpeed, LevelBestCompression}
for _, level := range levels {
level := level
t.Run(fmt.Sprintf("level %d", level), func(t *testing.T) {
t.Parallel()
app := fiber.New()
Expand Down
1 change: 1 addition & 0 deletions middleware/filesystem/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func Test_FileSystem(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, tt.url, nil))
Expand Down
14 changes: 2 additions & 12 deletions middleware/pprof/pprof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
)

func Test_Non_Pprof_Path(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New())
Expand All @@ -30,7 +29,6 @@ func Test_Non_Pprof_Path(t *testing.T) {
}

func Test_Non_Pprof_Path_WithPrefix(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New(Config{Prefix: "/federated-fiber"}))
Expand All @@ -49,7 +47,6 @@ func Test_Non_Pprof_Path_WithPrefix(t *testing.T) {
}

func Test_Pprof_Index(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New())
Expand All @@ -69,7 +66,6 @@ func Test_Pprof_Index(t *testing.T) {
}

func Test_Pprof_Index_WithPrefix(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New(Config{Prefix: "/federated-fiber"}))
Expand All @@ -89,7 +85,6 @@ func Test_Pprof_Index_WithPrefix(t *testing.T) {
}

func Test_Pprof_Subs(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New())
Expand All @@ -104,8 +99,8 @@ func Test_Pprof_Subs(t *testing.T) {
}

for _, sub := range subs {
sub := sub
t.Run(sub, func(t *testing.T) {
t.Parallel()
target := "/debug/pprof/" + sub
if sub == "profile" {
target += "?seconds=1"
Expand All @@ -118,7 +113,6 @@ func Test_Pprof_Subs(t *testing.T) {
}

func Test_Pprof_Subs_WithPrefix(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New(Config{Prefix: "/federated-fiber"}))
Expand All @@ -133,8 +127,8 @@ func Test_Pprof_Subs_WithPrefix(t *testing.T) {
}

for _, sub := range subs {
sub := sub
t.Run(sub, func(t *testing.T) {
t.Parallel()
target := "/federated-fiber/debug/pprof/" + sub
if sub == "profile" {
target += "?seconds=1"
Expand All @@ -147,7 +141,6 @@ func Test_Pprof_Subs_WithPrefix(t *testing.T) {
}

func Test_Pprof_Other(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New())
Expand All @@ -162,7 +155,6 @@ func Test_Pprof_Other(t *testing.T) {
}

func Test_Pprof_Other_WithPrefix(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{DisableStartupMessage: true})

app.Use(New(Config{Prefix: "/federated-fiber"}))
Expand All @@ -178,7 +170,6 @@ func Test_Pprof_Other_WithPrefix(t *testing.T) {

// go test -run Test_Pprof_Next
func Test_Pprof_Next(t *testing.T) {
t.Parallel()
app := fiber.New()

app.Use(New(Config{
Expand All @@ -194,7 +185,6 @@ func Test_Pprof_Next(t *testing.T) {

// go test -run Test_Pprof_Next_WithPrefix
func Test_Pprof_Next_WithPrefix(t *testing.T) {
t.Parallel()
app := fiber.New()

app.Use(New(Config{
Expand Down
Loading