chore: remove unnecessary redeclarations in for loops (#18440)

This commit is contained in:
ケイラ
2025-06-20 13:16:55 -06:00
committed by GitHub
parent 4fe0a4bca2
commit fae30a00fd
200 changed files with 0 additions and 431 deletions

View File

@ -107,7 +107,6 @@ func TestExtractUserRoles(t *testing.T) {
}
for _, c := range testCases {
c := c
t.Run(c.Name, func(t *testing.T) {
t.Parallel()

View File

@ -91,7 +91,6 @@ func TestWorkspaceAppCors(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

View File

@ -57,7 +57,6 @@ func TestCSRFExemptList(t *testing.T) {
csrfmw := mw(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})).(*nosurf.CSRFHandler)
for _, c := range cases {
c := c
t.Run(c.Name, func(t *testing.T) {
t.Parallel()

View File

@ -77,7 +77,6 @@ func TestHSTS(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()

View File

@ -247,7 +247,6 @@ func TestRequestLogger_RouteParamsLogging(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

View File

@ -108,7 +108,6 @@ func Test_RoutePatterns(t *testing.T) {
}
for _, c := range cases {
c := c
t.Run(c.name, func(t *testing.T) {
t.Parallel()

View File

@ -200,7 +200,6 @@ func TestExtractAddress(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()
@ -235,9 +234,6 @@ func TestTrustedOrigins(t *testing.T) {
// ipv6: trust an IPv4 network
for _, trusted := range []string{"none", "ipv4", "ipv6"} {
for _, header := range []string{"Cf-Connecting-Ip", "True-Client-Ip", "X-Real-Ip", "X-Forwarded-For"} {
trusted := trusted
header := header
proto := proto
name := fmt.Sprintf("%s-%s-%s", trusted, proto, strings.ToLower(header))
t.Run(name, func(t *testing.T) {
@ -311,7 +307,6 @@ func TestCorruptedHeaders(t *testing.T) {
t.Parallel()
for _, header := range []string{"Cf-Connecting-Ip", "True-Client-Ip", "X-Real-Ip", "X-Forwarded-For"} {
header := header
name := strings.ToLower(header)
t.Run(name, func(t *testing.T) {
@ -364,9 +359,6 @@ func TestAddressFamilies(t *testing.T) {
for _, clientFamily := range []string{"ipv4", "ipv6"} {
for _, proxyFamily := range []string{"ipv4", "ipv6"} {
for _, header := range []string{"Cf-Connecting-Ip", "True-Client-Ip", "X-Real-Ip", "X-Forwarded-For"} {
clientFamily := clientFamily
proxyFamily := proxyFamily
header := header
name := fmt.Sprintf("%s-%s-%s", strings.ToLower(header), clientFamily, proxyFamily)
t.Run(name, func(t *testing.T) {
@ -466,7 +458,6 @@ func TestFilterUntrusted(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()
@ -612,7 +603,6 @@ func TestApplicationProxy(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()

View File

@ -52,8 +52,6 @@ func TestRecover(t *testing.T) {
}
for _, c := range cases {
c := c
t.Run(c.Name, func(t *testing.T) {
t.Parallel()

View File

@ -316,7 +316,6 @@ func TestWorkspaceAgentByNameParam(t *testing.T) {
}
for _, c := range testCases {
c := c
t.Run(c.Name, func(t *testing.T) {
t.Parallel()
db, r := setupWorkspaceWithAgents(t, setupConfig{