Skip to content

Commit 1ae6ca7

Browse files
committed
Cosmetics: use WaitGroup instead of channel in test
1 parent 5674e19 commit 1ae6ca7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sqlite3_test/sqltest.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,11 @@ func TestPreparedStmt(t *testing.T) {
275275
}
276276

277277
const nRuns = 10
278-
ch := make(chan bool)
278+
var wg sync.WaitGroup
279279
for i := 0; i < nRuns; i++ {
280+
wg.Add(1)
280281
go func() {
281-
defer func() {
282-
ch <- true
283-
}()
282+
defer wg.Done()
284283
for j := 0; j < 10; j++ {
285284
count := 0
286285
if err := sel.QueryRow().Scan(&count); err != nil && err != sql.ErrNoRows {
@@ -294,9 +293,7 @@ func TestPreparedStmt(t *testing.T) {
294293
}
295294
}()
296295
}
297-
for i := 0; i < nRuns; i++ {
298-
<-ch
299-
}
296+
wg.Wait()
300297
}
301298

302299
// Benchmarks need to use panic() since b.Error errors are lost when

0 commit comments

Comments
 (0)