Skip to content

Commit

Permalink
database/sql: fix ctx.Done() == nil check
Browse files Browse the repository at this point in the history
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 <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
rsc committed Nov 15, 2017
1 parent 442d15a commit b9dca1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/database/sql/ctxutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit b9dca1b

Please sign in to comment.