File tree Expand file tree Collapse file tree 1 file changed +1
-26
lines changed
Expand file tree Collapse file tree 1 file changed +1
-26
lines changed Original file line number Diff line number Diff line change @@ -238,31 +238,6 @@ for multiple inputs/outputs to a system.
238238
239239## Parallel Tests
240240
241- Parallel tests, like some specialized loops (for example, those that spawn
242- goroutines or capture references as part of the loop body),
243- must take care to explicitly assign loop variables within the loop's scope to
244- ensure that they hold the expected values.
245-
246- ``` go
247- tests := []struct {
248- give string
249- // ...
250- }{
251- // ...
252- }
253-
254- for _ , tt := range tests {
255- tt := tt // for t.Parallel
256- t.Run (tt.give , func (t *testing.T ) {
257- t.Parallel ()
258- // ...
259- })
260- }
261- ```
262-
263- In the example above, we must declare a ` tt ` variable scoped to the loop
264- iteration because of the use of ` t.Parallel() ` below.
265- If we do not do that, most or all tests will receive an unexpected value for
266- ` tt ` , or a value that changes as they're running.
241+ Run ` t.Parallel() ` to improve the performance of your test cases.
267242
268243<!-- TODO: Explain how to use _test packages. -->
You can’t perform that action at this time.
0 commit comments