You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a test calls t.Run in a loop, and the t.Run function literal contains a call to t.Parallel, then the t.Run effectively turns from a synchronous call into a go statement.
func Test(t *testing.T) {
for name, value := range tests {
t.Run(name, func(t *testing.T) {
t.Parallel()
...
use(value) // oops! read of value races with loop index variable update
}
}
}
The loopclosure check could recognize this case and treat such t.Run calls equivalent to a go statement.
The text was updated successfully, but these errors were encountered:
If a test calls t.Run in a loop, and the t.Run function literal contains a call to t.Parallel, then the t.Run effectively turns from a synchronous call into a go statement.
The loopclosure check could recognize this case and treat such t.Run calls equivalent to a go statement.
The text was updated successfully, but these errors were encountered: