Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions database/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func RunMigrationsContext(ctx context.Context, logger log.Logger, config Databas
previousVersion = 0
dirty = false
}
span.SetAttributes(attribute.Int64("db.previous_version", int64(previousVersion)))
span.SetAttributes(attribute.Int64("db.previous_version", int64(previousVersion))) //nolint:gosec

err = m.Up()
migrationMutex.Unlock()
Expand All @@ -99,7 +99,7 @@ func RunMigrationsContext(ctx context.Context, logger log.Logger, config Databas
newVersion = 0
newDirty = false
}
span.SetAttributes(attribute.Int64("db.new_version", int64(newVersion)))
span.SetAttributes(attribute.Int64("db.new_version", int64(newVersion))) //nolint:gosec

logger.Info().Logf("Migrations complete: previous: %d (dirty:%v) -> new: %d (dirty:%v)", previousVersion, dirty, newVersion, newDirty)

Expand Down
1 change: 0 additions & 1 deletion database/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/stdlib"
_ "github.com/jackc/pgx/v5/stdlib"
"github.com/moov-io/base/log"
)

Expand Down
3 changes: 2 additions & 1 deletion sql/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (w *DB) Query(query string, args ...interface{}) (*gosql.Rows, error) {
done := w.start("query", query, len(args))
defer done()

//nolint:sqlclosecheck
r, err := w.DB.Query(query, args...)
return r, w.error(err)
}
Expand All @@ -101,7 +102,7 @@ func (w *DB) QueryContext(ctx context.Context, query string, args ...interface{}
done()
}()

r, err := w.DB.QueryContext(ctx, query, args...)
r, err := w.DB.QueryContext(ctx, query, args...) //nolint:sqlclosecheck
return r, w.error(err)
}

Expand Down
4 changes: 2 additions & 2 deletions sql/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (s *Stmt) Query(args ...any) (*gosql.Rows, error) {
done := s.start("query", s.query, len(args))
defer done()

r, err := s.ss.Query(args...)
r, err := s.ss.Query(args...) //nolint:sqlclosecheck
return r, s.error(err)
}

Expand All @@ -104,7 +104,7 @@ func (s *Stmt) QueryContext(ctx context.Context, args ...any) (*gosql.Rows, erro
done()
}()

r, err := s.ss.QueryContext(ctx, args...)
r, err := s.ss.QueryContext(ctx, args...) //nolint:sqlclosecheck
return r, s.error(err)
}

Expand Down
17 changes: 8 additions & 9 deletions sql/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sql

import (
"context"
"database/sql"
gosql "database/sql"
"fmt"
"time"
Expand Down Expand Up @@ -93,39 +92,39 @@ func (w *Tx) finished() {
w.done()
}

func (w *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
func (w *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (gosql.Result, error) {
done := w.start("exec", query, len(args))
defer done()

r, err := w.Tx.ExecContext(ctx, query, args...)
return r, w.error(err)
}

func (w *Tx) Exec(query string, args ...interface{}) (sql.Result, error) {
func (w *Tx) Exec(query string, args ...interface{}) (gosql.Result, error) {
done := w.start("exec", query, len(args))
defer done()

r, err := w.Tx.Exec(query, args...)
return r, w.error(err)
}

func (w *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) {
func (w *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*gosql.Rows, error) {
done := w.start("query", query, len(args))
defer done()

r, err := w.Tx.QueryContext(ctx, query, args...)
r, err := w.Tx.QueryContext(ctx, query, args...) //nolint:sqlclosecheck
return r, w.error(err)
}

func (w *Tx) Query(query string, args ...interface{}) (*sql.Rows, error) {
func (w *Tx) Query(query string, args ...interface{}) (*gosql.Rows, error) {
done := w.start("query", query, len(args))
defer done()

r, err := w.Tx.Query(query, args...)
r, err := w.Tx.Query(query, args...) //nolint:sqlclosecheck
return r, w.error(err)
}

func (w *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row {
func (w *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *gosql.Row {
done := w.start("query-row", query, len(args))
defer done()

Expand All @@ -135,7 +134,7 @@ func (w *Tx) QueryRowContext(ctx context.Context, query string, args ...interfac
return r
}

func (w *Tx) QueryRow(query string, args ...interface{}) *sql.Row {
func (w *Tx) QueryRow(query string, args ...interface{}) *gosql.Row {
done := w.start("query-row", query, len(args))
defer done()

Expand Down
2 changes: 1 addition & 1 deletion telemetry/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func createAttributes(val reflect.Value, tag *otelTag) (kv []attribute.KeyValue)
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
kv = append(kv, attribute.Int64(tag.attributeName, val.Int()))
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
kv = append(kv, attribute.Int64(tag.attributeName, int64(val.Uint())))
kv = append(kv, attribute.Int64(tag.attributeName, int64(val.Uint()))) //nolint:gosec
case reflect.Float32, reflect.Float64:
kv = append(kv, attribute.Float64(tag.attributeName, val.Float()))
case reflect.Complex64, reflect.Complex128:
Expand Down
Loading