Cosmetics: use WaitGroup instead of channel in test
This commit is contained in:
parent
5674e19d05
commit
1ae6ca764d
|
@ -275,12 +275,11 @@ func TestPreparedStmt(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const nRuns = 10
|
const nRuns = 10
|
||||||
ch := make(chan bool)
|
var wg sync.WaitGroup
|
||||||
for i := 0; i < nRuns; i++ {
|
for i := 0; i < nRuns; i++ {
|
||||||
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer func() {
|
defer wg.Done()
|
||||||
ch <- true
|
|
||||||
}()
|
|
||||||
for j := 0; j < 10; j++ {
|
for j := 0; j < 10; j++ {
|
||||||
count := 0
|
count := 0
|
||||||
if err := sel.QueryRow().Scan(&count); err != nil && err != sql.ErrNoRows {
|
if err := sel.QueryRow().Scan(&count); err != nil && err != sql.ErrNoRows {
|
||||||
|
@ -294,9 +293,7 @@ func TestPreparedStmt(t *testing.T) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
for i := 0; i < nRuns; i++ {
|
wg.Wait()
|
||||||
<-ch
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Benchmarks need to use panic() since b.Error errors are lost when
|
// Benchmarks need to use panic() since b.Error errors are lost when
|
||||||
|
|
Loading…
Reference in New Issue