2
0

Use errors instead of golang.org/x/xerrors

This commit is contained in:
Jack Christensen
2021-03-25 09:55:12 -04:00
parent 80147fd7cc
commit a49f4bb135
15 changed files with 47 additions and 56 deletions
+3 -4
View File
@@ -52,6 +52,7 @@ import (
"context"
"database/sql"
"database/sql/driver"
"errors"
"fmt"
"io"
"math"
@@ -61,8 +62,6 @@ import (
"sync"
"time"
errors "golang.org/x/xerrors"
"github.com/jackc/pgconn"
"github.com/jackc/pgtype"
"github.com/jackc/pgx/v4"
@@ -308,7 +307,7 @@ func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, e
case sql.LevelSerializable:
pgxOpts.IsoLevel = pgx.Serializable
default:
return nil, errors.Errorf("unsupported isolation: %v", opts.Isolation)
return nil, fmt.Errorf("unsupported isolation: %v", opts.Isolation)
}
if opts.ReadOnly {
@@ -779,7 +778,7 @@ func ReleaseConn(db *sql.DB, conn *pgx.Conn) error {
fakeTxMutex.Unlock()
} else {
fakeTxMutex.Unlock()
return errors.Errorf("can't release conn that is not acquired")
return fmt.Errorf("can't release conn that is not acquired")
}
return tx.Rollback()