test: add buffer to a channel to avoid the goroutine leak

This commit is contained in:
lzhfromustc 2020-12-09 22:46:50 -05:00
parent f6be823028
commit 981093d53c

View File

@ -1122,7 +1122,7 @@ func TestDB_Batch(t *testing.T) {
// Iterate over multiple updates in separate goroutines.
n := 2
ch := make(chan error)
ch := make(chan error, n)
for i := 0; i < n; i++ {
go func(i int) {
ch <- db.Batch(func(tx *bolt.Tx) error {