aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/clientserver_test.go
diff options
context:
space:
mode:
authorCarlos Amedee <carlos@golang.org>2025-02-11 15:50:55 -0500
committerCarlos Amedee <carlos@golang.org>2025-02-14 09:59:55 -0800
commit45447b4bfff4227a8945951dd7d37f2873992e1b (patch)
tree884968abd9d76d372d3bb0dcb68cbb5bf35b8139 /src/net/http/clientserver_test.go
parent85f8e240fe337b145aba1de5edd2b03e759e4e38 (diff)
downloadgo-45447b4bfff4227a8945951dd7d37f2873992e1b.tar.xz
net/http: use runtime.AddCleanup instead of runtime.SetFinalizer
Replace the usage of runtime.SetFinalizer with runtime.AddCleanup in tests. Updates #70907 Change-Id: Idd3f1c07f6a7709352ca09948fbcb4a0ad9418bb Reviewed-on: https://go-review.googlesource.com/c/go/+/648655 Auto-Submit: Carlos Amedee <carlos@golang.org> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/net/http/clientserver_test.go')
-rw-r--r--src/net/http/clientserver_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/http/clientserver_test.go b/src/net/http/clientserver_test.go
index 32d97ea9f0..208c6509fa 100644
--- a/src/net/http/clientserver_test.go
+++ b/src/net/http/clientserver_test.go
@@ -1253,7 +1253,7 @@ func testTransportGCRequest(t *testing.T, mode testMode, body bool) {
(func() {
body := strings.NewReader("some body")
req, _ := NewRequest("POST", cst.ts.URL, body)
- runtime.SetFinalizer(req, func(*Request) { close(didGC) })
+ runtime.AddCleanup(req, func(ch chan struct{}) { close(ch) }, didGC)
res, err := cst.c.Do(req)
if err != nil {
t.Fatal(err)