chore: remove unnecessary loop variable captures (#22180)

Since Go 1.22, the loop variable capture issue is resolved. Variables
declared by for loops are now per-iteration rather than per-loop, making
the 'v := v' pattern unnecessary.
This commit is contained in:
Danielle Maywood
2026-02-19 09:02:19 +00:00
committed by GitHub
parent d9ec892b9a
commit 92a6d6c2c0
25 changed files with 0 additions and 37 deletions
-2
View File
@@ -715,7 +715,6 @@ func PprofInfo(ctx context.Context, client *codersdk.Client, log slog.Logger) *P
}
for endpoint, setter := range endpoints {
endpoint, setter := endpoint, setter
eg.Go(func() error {
timeout := 10 * time.Second
if strings.Contains(endpoint, "seconds=30") {
@@ -822,7 +821,6 @@ func PprofInfoFromAgent(ctx context.Context, conn workspacesdk.AgentConn, log sl
// Collect each endpoint in parallel
for endpoint, setter := range endpoints {
endpoint, setter := endpoint, setter // capture loop variables
eg.Go(func() error {
// Set longer timeout for profile and trace endpoints (they take 30 seconds)
timeout := 10 * time.Second