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

@ -96,8 +96,6 @@ func TestCheckACLPermissions(t *testing.T) {
}
for _, c := range testCases {
c := c
t.Run("CheckAuthorization/"+c.Name, func(t *testing.T) {
t.Parallel()

View File

@ -292,8 +292,6 @@ func TestEntitlements_Prebuilds(t *testing.T) {
}
for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
@ -618,7 +616,6 @@ func TestSCIMDisabled(t *testing.T) {
}
for _, p := range checkPaths {
p := p
t.Run(p, func(t *testing.T) {
t.Parallel()

View File

@ -296,7 +296,6 @@ func TestOrganizationSync(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.Name, func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)

View File

@ -126,7 +126,6 @@ func TestExtractProvisionerDaemonAuthenticated(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
routeCtx := chi.NewRouteContext()

View File

@ -34,7 +34,6 @@ func TestTemplateInsightsWithTemplateAdminACL(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(fmt.Sprintf("with interval=%q", tt.interval), func(t *testing.T) {
t.Parallel()
@ -94,7 +93,6 @@ func TestTemplateInsightsWithRole(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(fmt.Sprintf("with interval=%q role=%q", tt.interval, tt.role), func(t *testing.T) {
t.Parallel()

View File

@ -848,8 +848,6 @@ func TestLicenseEntitlements(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.Name, func(t *testing.T) {
t.Parallel()

View File

@ -128,7 +128,6 @@ func TestClaimPrebuild(t *testing.T) {
for name, tc := range cases {
// Ensure that prebuilt workspaces can be claimed in non-default organizations:
for _, useDefaultOrg := range []bool{true, false} {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()

View File

@ -56,7 +56,6 @@ func TestReconcileAll(t *testing.T) {
}
for _, tc := range tests {
tc := tc // capture
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View File

@ -176,19 +176,12 @@ func TestMetricsCollector(t *testing.T) {
},
}
for _, test := range tests {
test := test // capture for parallel
for _, transition := range test.transitions {
transition := transition // capture for parallel
for _, jobStatus := range test.jobStatuses {
jobStatus := jobStatus // capture for parallel
for _, initiatorID := range test.initiatorIDs {
initiatorID := initiatorID // capture for parallel
for _, ownerID := range test.ownerIDs {
ownerID := ownerID // capture for parallel
for _, templateDeleted := range test.templateDeleted {
templateDeleted := templateDeleted // capture for parallel
for _, eligible := range test.eligible {
eligible := eligible // capture for parallel
t.Run(fmt.Sprintf("%v/transition:%s/jobStatus:%s", test.name, transition, jobStatus), func(t *testing.T) {
t.Parallel()
@ -259,7 +252,6 @@ func TestMetricsCollector(t *testing.T) {
require.Equal(t, 1, len(presets))
for _, preset := range presets {
preset := preset // capture for parallel
labels := map[string]string{
"template_name": template.Name,
"preset_name": preset.Name,

View File

@ -308,7 +308,6 @@ func TestPrebuildReconciliation(t *testing.T) {
},
}
for _, tc := range testCases {
tc := tc // capture for parallel
for _, templateVersionActive := range tc.templateVersionActive {
for _, prebuildLatestTransition := range tc.prebuildLatestTransitions {
for _, prebuildJobStatus := range tc.prebuildJobStatuses {

View File

@ -921,7 +921,6 @@ func TestGetProvisionerDaemons(t *testing.T) {
},
}
for _, tt := range testCases {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
dv := coderdtest.DeploymentValues(t)

View File

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

View File

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

View File

@ -191,8 +191,6 @@ func TestTemplateUpdateBuildDeadlines(t *testing.T) {
}
for _, c := range cases {
c := c
t.Run(c.name, func(t *testing.T) {
t.Parallel()
@ -778,8 +776,6 @@ func TestTemplateTTL(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

View File

@ -470,8 +470,6 @@ func TestTemplates(t *testing.T) {
}
for _, c := range cases {
c := c
// nolint: paralleltest // context is from parent t.Run
t.Run(c.Name, func(t *testing.T) {
_, err := anotherClient.UpdateTemplateMeta(ctx, template.ID, codersdk.UpdateTemplateMeta{

View File

@ -902,7 +902,6 @@ func TestGroupSync(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
runner := setupOIDCTest(t, oidcTestConfig{

View File

@ -426,7 +426,6 @@ func TestGrantSiteRoles(t *testing.T) {
}
for _, c := range testCases {
c := c
t.Run(c.Name, func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)

View File

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

View File

@ -1952,7 +1952,6 @@ func TestWorkspaceTagsTerraform(t *testing.T) {
}`,
},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
client, owner := coderdenttest.New(t, &coderdenttest.Options{
Options: &coderdtest.Options{