Closed kaihendry closed 4 years ago
@kaihendry If you'd like to add this as a feature, feel free to submit a PR, and I will approve it.
Hello, @zolotov!
With this feature merged into the origin/develop
, it would be great to take advantage of it in the IntelliJ IDEA/GoLand IDEs.
At least the tc := tc // capture range variable
part of the generated code example:
func TestGroupedParallel(t *testing.T) {
for _, tc := range tests {
tc := tc // capture range variable
t.Run(tc.Name, func(t *testing.T) {
t.Parallel()
...
})
}
}
Motivation: it's always safer to capture for loop range variables. If someone later on decided to run subtest as Parallel, there would be one less chance to miss the mentioned tc := tc
. It looks like this is aligned with Jetbrain's goals to make developer life less error-prone.
@skovtunenko Hi!
I don't think it relates to gotests
project, so could you file a feature request on GoLand tracker instead, please? Also, it would be nice if you provide the code with problem to catch, the current code is fine as tc
is not used in any goroutine.
Can these tests be generated to be run in parallel?
https://twitter.com/peterbourgon/status/1169414085097607168