diff options
author | Lars Buitinck <l.buitinck@esciencecenter.nl> | 2015-06-05 16:33:55 +0200 |
---|---|---|
committer | Lars Buitinck <l.buitinck@esciencecenter.nl> | 2015-06-05 16:38:51 +0200 |
commit | 1ae6ca764d50a6a0f3d30009a287623337b534c7 (patch) | |
tree | 06cf797d5e46a97ad560c82acadeb8b67e33f418 /sqlite3_test/sqltest.go | |
parent | Test read-only databases (diff) | |
download | golite-1ae6ca764d50a6a0f3d30009a287623337b534c7.tar.gz golite-1ae6ca764d50a6a0f3d30009a287623337b534c7.tar.xz |
Cosmetics: use WaitGroup instead of channel in test
Diffstat (limited to '')
-rw-r--r-- | sqlite3_test/sqltest.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sqlite3_test/sqltest.go b/sqlite3_test/sqltest.go index fc82782..06cfd0e 100644 --- a/sqlite3_test/sqltest.go +++ b/sqlite3_test/sqltest.go @@ -275,12 +275,11 @@ func TestPreparedStmt(t *testing.T) { } const nRuns = 10 - ch := make(chan bool) + var wg sync.WaitGroup for i := 0; i < nRuns; i++ { + wg.Add(1) go func() { - defer func() { - ch <- true - }() + defer wg.Done() for j := 0; j < 10; j++ { count := 0 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++ { - <-ch - } + wg.Wait() } // Benchmarks need to use panic() since b.Error errors are lost when |