select {
case <-ctx.Done():
if err := ctx.Err(); err != context.Canceled {
- t.Fatalf("context err = %v; want context.Canceled")
+ t.Fatalf("context err = %v; want context.Canceled", err)
}
default:
t.Fatalf("context err = nil; want context.Canceled")
defer closeDB(t, db)
prepares0 := numPrepares(t, db)
- ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*15)
+ ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*15)
+ defer cancel()
// This will trigger the *fakeConn.Prepare method which will take time
// performing the query. The ctxDriverPrepare func will check the context
db := newTestDB(t, "people")
defer closeDB(t, db)
- ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*15)
+ ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*15)
+ defer cancel()
tx, err := db.BeginTx(ctx, nil)
if err != nil {