From b9dca1b165fad8d8ad8fcd47cfa7bf0d5ae60c63 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 15 Nov 2017 15:14:07 -0500 Subject: [PATCH] database/sql: fix ctx.Done() == nil check ctx.Done() == ctx.Background().Done() is just a long way to write ctx.Done() == nil. Use the short way. Change-Id: I7b3198b5dc46b8b40086243aa61882bc8c268eac Reviewed-on: https://go-review.googlesource.com/78128 Run-TryBot: Russ Cox Reviewed-by: Brad Fitzpatrick --- src/database/sql/ctxutil.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/database/sql/ctxutil.go b/src/database/sql/ctxutil.go index 170ec7d8a02117..af2afd5aa57043 100644 --- a/src/database/sql/ctxutil.go +++ b/src/database/sql/ctxutil.go @@ -120,7 +120,7 @@ func ctxDriverBegin(ctx context.Context, opts *TxOptions, ci driver.Conn) (drive } } - if ctx.Done() == context.Background().Done() { + if ctx.Done() == nil { return ci.Begin() }