Skip to content

Commit 5f8e820

Browse files
test: use WaitGroup.Go to simplify code (#3239)
refactor: use WaitGroup.Go to simplify code Signed-off-by: stringsbuilder <stringsbuilder@outlook.com>
1 parent a9e08e8 commit 5f8e820

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

pkg/sync/syncer_status_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ func TestSyncerStatusStartOnce(t *testing.T) {
2525
var wg sync.WaitGroup
2626

2727
for range 8 {
28-
wg.Add(1)
29-
go func() {
30-
defer wg.Done()
28+
wg.Go(func() {
3129
_, err := status.startOnce(func() error {
3230
if calls.Add(1) == 1 {
3331
close(started)
@@ -36,7 +34,7 @@ func TestSyncerStatusStartOnce(t *testing.T) {
3634
return nil
3735
})
3836
require.NoError(t, err)
39-
}()
37+
})
4038
}
4139

4240
<-started

0 commit comments

Comments
 (0)