mirror of https://github.com/gofiber/fiber.git
Fix loop variable captured by func literal (#2660)
* fix loop variable xxx captured by func literal * fix middleware/pprof testspull/2664/head
parent
ab4e731607
commit
0d3354675b
|
@ -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()
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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())
|
||||
|
@ -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"}))
|
||||
|
@ -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())
|
||||
|
@ -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"}))
|
||||
|
@ -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())
|
||||
|
@ -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"
|
||||
|
@ -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"}))
|
||||
|
@ -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"
|
||||
|
@ -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())
|
||||
|
@ -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"}))
|
||||
|
@ -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{
|
||||
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue