From 136332571bcc552b9cc3ff8ac44aeb370425e7d7 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sun, 5 Apr 2026 05:54:44 +0000 Subject: net: cancel2 should not be shadow Fixes #78531 Change-Id: I7ccd84f9a3ced75c86b7540d84309e094717ffba GitHub-Last-Rev: 03a8ee1fd132a597e1a1e30add7cf7ba00ac114a GitHub-Pull-Request: golang/go#78532 Reviewed-on: https://go-review.googlesource.com/c/go/+/762780 Auto-Submit: Nicholas Husin Reviewed-by: Sean Liao Reviewed-by: Nicholas Husin Reviewed-by: Florian Lehner Reviewed-by: David Chase LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com Reviewed-by: Nicholas Husin --- src/net/dial.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/dial.go b/src/net/dial.go index a87c57603a..10c0068449 100644 --- a/src/net/dial.go +++ b/src/net/dial.go @@ -572,7 +572,8 @@ func (d *Dialer) dialCtx(ctx context.Context) (context.Context, context.CancelFu } } if oldCancel := d.Cancel; oldCancel != nil { - subCtx, cancel2 := context.WithCancel(ctx) + var subCtx context.Context + subCtx, cancel2 = context.WithCancel(ctx) go func() { select { case <-oldCancel: -- cgit v1.3