From f498f2e882074780f4b7f416590ab76cccb4d2c0 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 3 Nov 2025 15:33:20 +0000 Subject: [PATCH] fix: resolve `copyloopvar` issues Signed-off-by: Babak K. Shandiz --- api/pull_request_test.go | 2 -- internal/safepaths/absolute_test.go | 1 - pkg/cmd/codespace/ports.go | 1 - pkg/cmd/codespace/ssh.go | 5 ++--- pkg/cmd/root/help_topic_test.go | 1 - 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/api/pull_request_test.go b/api/pull_request_test.go index 6c15cdddd..8ccfa976f 100644 --- a/api/pull_request_test.go +++ b/api/pull_request_test.go @@ -127,7 +127,6 @@ func TestChecksStatus_SummarisingCheckRuns(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -180,7 +179,6 @@ func TestChecksStatus_SummarisingStatusContexts(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/safepaths/absolute_test.go b/internal/safepaths/absolute_test.go index 7bda40d89..8446fbfcc 100644 --- a/internal/safepaths/absolute_test.go +++ b/internal/safepaths/absolute_test.go @@ -83,7 +83,6 @@ func TestJoin(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() joinedPath, err := tt.base.Join(tt.elems...) diff --git a/pkg/cmd/codespace/ports.go b/pkg/cmd/codespace/ports.go index cd6656cf4..ef386dc86 100644 --- a/pkg/cmd/codespace/ports.go +++ b/pkg/cmd/codespace/ports.go @@ -329,7 +329,6 @@ func (a *App) ForwardPorts(ctx context.Context, selector *CodespaceSelector, por // them at the first failure, including cancellation of the context. group, ctx := errgroup.WithContext(ctx) for _, pair := range portPairs { - pair := pair group.Go(func() error { listen, _, err := codespaces.ListenTCP(pair.local, true) if err != nil { diff --git a/pkg/cmd/codespace/ssh.go b/pkg/cmd/codespace/ssh.go index 70e7ceb42..cd90541f2 100644 --- a/pkg/cmd/codespace/ssh.go +++ b/pkg/cmd/codespace/ssh.go @@ -584,9 +584,8 @@ func (a *App) printOpenSSHConfig(ctx context.Context, opts sshOptions) (err erro continue } - cs := cs wg.Add(1) - go func() { + go func(cs *api.Codespace) { result := sshResult{} defer wg.Done() @@ -622,7 +621,7 @@ func (a *App) printOpenSSHConfig(ctx context.Context, opts sshOptions) (err erro result.codespace = cs sshUsers <- result - }() + }(cs) } go func() { diff --git a/pkg/cmd/root/help_topic_test.go b/pkg/cmd/root/help_topic_test.go index baa4f7f56..0113eccfb 100644 --- a/pkg/cmd/root/help_topic_test.go +++ b/pkg/cmd/root/help_topic_test.go @@ -60,7 +60,6 @@ func TestCmdHelpTopic(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel()