go t.Parallel
usage of t.Parallel in testing package in Go
code:go
func TestA(t *testing.T) {
t.Parallel() // this function can be run in parallel
tests := []struct{
desc string
...
}{
{
...
},
...
}
for _, tc := range tests {
tc := tc // capture variable
t.Run(tc.name, func(t *testing.T) {
t.Parallel() // this test case can be run in parallel
...
})
}
}
https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks
https://engineering.mercari.com/blog/entry/how_to_use_t_parallel/ (https://engineering.mercari.com/en/blog/entry/20220408-how_to_use_t_parallel/)
https://future-architect.github.io/articles/20200601