]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid loop variable capture in test
authorMichael Pratt <mpratt@google.com>
Wed, 4 Aug 2021 20:07:47 +0000 (16:07 -0400)
committerMichael Pratt <mpratt@google.com>
Tue, 14 Sep 2021 21:57:30 +0000 (21:57 +0000)
commitb2c04f0d48234765ce37bbb178bd174f3857929a
treec335478c7965b18f542dcfc18a5554d78e7d08f7
parent181e8cde301cd8205489e746334174fee7290c9b
runtime: avoid loop variable capture in test

In TestSegv, the t.Run closure captures the loop variable 'test'. Since
the subtest calls t.Parallel, the parent test is allowed to keep
running, changing the loop variable and thus changing the value of
'test' in the subtest.

Change-Id: I021ddc50304de08a341e6ffe486aa54e573d3b94
Reviewed-on: https://go-review.googlesource.com/c/go/+/339911
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/crash_cgo_test.go