aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/sql_test.go
diff options
context:
space:
mode:
authorDaniel Theophanes <kardianos@gmail.com>2021-07-12 09:25:04 -0500
committerDaniel Theophanes <kardianos@gmail.com>2021-11-03 22:51:09 +0000
commit1f368d5b860b178bcbd55dfeb64474295263516b (patch)
tree15044e9c6db0af964a6d08bdd3bf50dec975754d /src/database/sql/sql_test.go
parentd3f5dd57811ca6c55654e67c58cf594fc2e5091e (diff)
downloadgo-1f368d5b860b178bcbd55dfeb64474295263516b.tar.xz
database/sql: use errors.Is when checking ErrBadConn
When drivers return driver.ErrBadConn, no meaningful information about what the cause of the problem is returned. Ideally the driver.ErrBadConn would be always caught with the retry loop, but this is not always the case. Drivers today must choose between returning a useful error and use the rety logic. This allows supporting both. Fixes #47142 Change-Id: I454573028f041dfdf874eed6c254fb194ccf6d96 Reviewed-on: https://go-review.googlesource.com/c/go/+/333949 Run-TryBot: Ian Lance Taylor <iant@golang.org> Trust: Ian Lance Taylor <iant@golang.org> Trust: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/database/sql/sql_test.go')
-rw-r--r--src/database/sql/sql_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/database/sql/sql_test.go b/src/database/sql/sql_test.go
index 15c30e0d00..889adc3164 100644
--- a/src/database/sql/sql_test.go
+++ b/src/database/sql/sql_test.go
@@ -3159,7 +3159,7 @@ func TestTxEndBadConn(t *testing.T) {
return broken
}
- if err := op(); err != driver.ErrBadConn {
+ if err := op(); !errors.Is(err, driver.ErrBadConn) {
t.Errorf(name+": %v", err)
return
}