Skip to content

Commit 1540631

Browse files
authored
Merge pull request #139 from cockroachdb/crl_fmt
Run cockroach-go through crlfmt.
2 parents 1740cc9 + d42a7c3 commit 1540631

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

crdb/common.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
package crdb
1616

17-
import (
18-
"context"
19-
)
17+
import "context"
2018

2119
// Tx abstracts the operations needed by ExecuteInTx so that different
2220
// frameworks (e.g. go's sql package, pgx, gorm) can be used with ExecuteInTx.

crdb/crdbpgx/pgx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ package crdbpgx
1616

1717
import (
1818
"context"
19-
"github.com/cockroachdb/cockroach-go/v2/crdb"
2019

20+
"github.com/cockroachdb/cockroach-go/v2/crdb"
2121
"github.com/jackc/pgx/v4"
2222
)
2323

crdb/crdbpgx/pgx_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ package crdbpgx
1717
import (
1818
"context"
1919
"fmt"
20+
"testing"
21+
2022
"github.com/cockroachdb/cockroach-go/v2/crdb"
2123
"github.com/cockroachdb/cockroach-go/v2/testserver"
2224
"github.com/jackc/pgx/v4"
2325
"github.com/jackc/pgx/v4/pgxpool"
24-
"testing"
2526
)
2627

2728
// TestExecuteTx verifies transaction retry using the classic

crdb/crdbsqlx/sqlx.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ import (
1818
"context"
1919
"database/sql"
2020

21+
"github.com/cockroachdb/cockroach-go/v2/crdb"
2122
"github.com/jmoiron/sqlx"
2223
_ "github.com/lib/pq"
23-
24-
"github.com/cockroachdb/cockroach-go/v2/crdb"
2524
)
2625

2726
// ExecuteTx runs fn inside a transaction and retries it as needed. On
2827
// non-retryable failures, the transaction is aborted and rolled back; on
2928
// success, the transaction is committed.
3029
//
3130
// See crdb.ExecuteTx() for more information.
32-
func ExecuteTx(ctx context.Context, db *sqlx.DB, opts *sql.TxOptions, fn func(*sqlx.Tx) error) error {
31+
func ExecuteTx(
32+
ctx context.Context, db *sqlx.DB, opts *sql.TxOptions, fn func(*sqlx.Tx) error,
33+
) error {
3334
tx, err := db.BeginTxx(ctx, opts)
3435
if err != nil {
3536
return err

crdb/crdbsqlx/sqlx_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ import (
1919
"fmt"
2020
"testing"
2121

22-
"github.com/jmoiron/sqlx"
23-
_ "github.com/lib/pq"
24-
2522
"github.com/cockroachdb/cockroach-go/v2/crdb"
2623
"github.com/cockroachdb/cockroach-go/v2/testserver"
24+
"github.com/jmoiron/sqlx"
25+
_ "github.com/lib/pq"
2726
)
2827

2928
// TestExecuteTx verifies transaction retry using the classic
@@ -94,7 +93,9 @@ func (t sqlxConnSkewTest) GetBalances(ctx context.Context, txi interface{}) (int
9493
}
9594

9695
// UpdateBalance is part of the crdb.WriteSkewInterface.
97-
func (t sqlxConnSkewTest) UpdateBalance(ctx context.Context, txi interface{}, acct, delta int) error {
96+
func (t sqlxConnSkewTest) UpdateBalance(
97+
ctx context.Context, txi interface{}, acct, delta int,
98+
) error {
9899
tx := txi.(*sqlx.Tx)
99100
_, err := tx.ExecContext(ctx, `UPDATE d.t SET balance=balance+$1 WHERE acct=$2;`, delta, acct)
100101
return err

0 commit comments

Comments
 (0)