Skip to content

Commit

Permalink
Fix linter.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbub committed Oct 10, 2024
1 parent 56c3e5e commit 6380571
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

var (
_ driver.Pinger = (*connection)(nil)
_ driver.Execer = (*connection)(nil)
_ driver.Execer = (*connection)(nil) // nolint:staticcheck
_ driver.ExecerContext = (*connection)(nil)
_ driver.Queryer = (*connection)(nil)
_ driver.Queryer = (*connection)(nil) // nolint:staticcheck
_ driver.QueryerContext = (*connection)(nil)
_ driver.Conn = (*connection)(nil)
_ driver.ConnPrepareContext = (*connection)(nil)
Expand Down Expand Up @@ -47,7 +47,7 @@ func (c *connection) BeginTx(ctx context.Context, opts driver.TxOptions) (driver
}

func (c *connection) Query(query string, args []driver.Value) (driver.Rows, error) {
queryer, ok := c.Conn.(driver.Queryer)
queryer, ok := c.Conn.(driver.Queryer) // nolint:staticcheck
if !ok {
return nil, driver.ErrSkip
}
Expand All @@ -63,7 +63,7 @@ func (c *connection) QueryContext(ctx context.Context, query string, args []driv
}

func (c *connection) Exec(query string, args []driver.Value) (driver.Result, error) {
execer, ok := c.Conn.(driver.Execer)
execer, ok := c.Conn.(driver.Execer) // nolint:staticcheck
if !ok {
return nil, driver.ErrSkip
}
Expand Down
24 changes: 12 additions & 12 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestWrapDriver(t *testing.T) {
{
name: "QueryContext no attrs",
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
db.QueryContext(ctx, "SELECT 1")
_, _ = db.QueryContext(ctx, "SELECT 1")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertQueryContext(t, "SELECT 1", 0)
Expand All @@ -29,7 +29,7 @@ func TestWrapDriver(t *testing.T) {
name: "QueryContext with attrs",
options: []Option{WithAttrPairs("key", "value"), WithAttrPairs("key2", "value 2")},
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
db.QueryContext(ctx, "SELECT 1")
_, _ = db.QueryContext(ctx, "SELECT 1")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertQueryContext(t, "SELECT 1 /*key='value',key2='value%202'*/", 0)
Expand All @@ -44,7 +44,7 @@ func TestWrapDriver(t *testing.T) {
return withUserKey(context.Background(), "my-key")
},
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
db.QueryContext(ctx, "SELECT 1")
_, _ = db.QueryContext(ctx, "SELECT 1")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertQueryContext(t, "SELECT 1 /*user-key='my-key'*/", 0)
Expand All @@ -53,7 +53,7 @@ func TestWrapDriver(t *testing.T) {
{
name: "ExecContext no attrs",
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
db.ExecContext(ctx, "UPDATE users SET name = 'joe'")
_, _ = db.ExecContext(ctx, "UPDATE users SET name = 'joe'")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertExecContext(t, "UPDATE users SET name = 'joe'", 0)
Expand All @@ -63,7 +63,7 @@ func TestWrapDriver(t *testing.T) {
name: "ExecContext with attrs",
options: []Option{WithAttrPairs("key", "value")},
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
db.ExecContext(ctx, "UPDATE users SET name = 'joe'")
_, _ = db.ExecContext(ctx, "UPDATE users SET name = 'joe'")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertExecContext(t, "UPDATE users SET name = 'joe' /*key='value'*/", 0)
Expand All @@ -78,7 +78,7 @@ func TestWrapDriver(t *testing.T) {
return withUserKey(context.Background(), "my-key")
},
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
db.ExecContext(ctx, "UPDATE users SET name = 'joe'")
_, _ = db.ExecContext(ctx, "UPDATE users SET name = 'joe'")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertExecContext(t, "UPDATE users SET name = 'joe' /*user-key='my-key'*/", 0)
Expand All @@ -95,10 +95,10 @@ func TestWrapDriver(t *testing.T) {
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
tx, err := db.Begin()
assertNoError(t, err)
defer tx.Commit()
defer func() { _ = tx.Commit() }()

tx.QueryContext(ctx, "SELECT 1")
tx.QueryContext(ctx, "SELECT 2")
_, _ = tx.QueryContext(ctx, "SELECT 1")
_, _ = tx.QueryContext(ctx, "SELECT 2")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertQueryContext(t, "SELECT 1 /*user-key='my-key'*/", 0)
Expand All @@ -116,10 +116,10 @@ func TestWrapDriver(t *testing.T) {
perform: func(t *testing.T, ctx context.Context, db *sql.DB) {
tx, err := db.Begin()
assertNoError(t, err)
defer tx.Commit()
defer func() { _ = tx.Commit() }()

tx.ExecContext(ctx, "UPDATE users SET name = 'joe'")
tx.ExecContext(ctx, "UPDATE users SET name = 'doe'")
_, _ = tx.ExecContext(ctx, "UPDATE users SET name = 'joe'")
_, _ = tx.ExecContext(ctx, "UPDATE users SET name = 'doe'")
},
assert: func(t *testing.T, conn *mockConn) {
conn.assertExecContext(t, "UPDATE users SET name = 'joe' /*user-key='my-key'*/", 0)
Expand Down

0 comments on commit 6380571

Please sign in to comment.