Skip to content

Commit 71ce86f

Browse files
gonzaloserranogithub-actions[bot]
authored andcommitted
Auto-update style.md
1 parent 8cfd3d4 commit 71ce86f

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

style.md

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3898,32 +3898,7 @@ for multiple inputs/outputs to a system.
38983898

38993899
#### Parallel Tests
39003900

3901-
Parallel tests, like some specialized loops (for example, those that spawn
3902-
goroutines or capture references as part of the loop body),
3903-
must take care to explicitly assign loop variables within the loop's scope to
3904-
ensure that they hold the expected values.
3905-
3906-
```go
3907-
tests := []struct{
3908-
give string
3909-
// ...
3910-
}{
3911-
// ...
3912-
}
3913-
3914-
for _, tt := range tests {
3915-
tt := tt // for t.Parallel
3916-
t.Run(tt.give, func(t *testing.T) {
3917-
t.Parallel()
3918-
// ...
3919-
})
3920-
}
3921-
```
3922-
3923-
In the example above, we must declare a `tt` variable scoped to the loop
3924-
iteration because of the use of `t.Parallel()` below.
3925-
If we do not do that, most or all tests will receive an unexpected value for
3926-
`tt`, or a value that changes as they're running.
3901+
Run `t.Parallel()` to improve the performance of your test cases.
39273902

39283903
<!-- TODO: Explain how to use _test packages. -->
39293904

0 commit comments

Comments
 (0)