diff --git a/database/migrator.go b/database/migrator.go index 5834e183..fdfb70aa 100644 --- a/database/migrator.go +++ b/database/migrator.go @@ -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() @@ -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) diff --git a/database/postgres.go b/database/postgres.go index 873c43ff..8fe7499d 100644 --- a/database/postgres.go +++ b/database/postgres.go @@ -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" ) diff --git a/sql/db.go b/sql/db.go index baeea45d..ef74b86b 100644 --- a/sql/db.go +++ b/sql/db.go @@ -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) } @@ -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) } diff --git a/sql/stmt.go b/sql/stmt.go index 93ba454f..13bd337a 100644 --- a/sql/stmt.go +++ b/sql/stmt.go @@ -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) } @@ -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) } diff --git a/sql/tx.go b/sql/tx.go index abe81bcf..5f643501 100644 --- a/sql/tx.go +++ b/sql/tx.go @@ -2,7 +2,6 @@ package sql import ( "context" - "database/sql" gosql "database/sql" "fmt" "time" @@ -93,7 +92,7 @@ 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() @@ -101,7 +100,7 @@ func (w *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) 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() @@ -109,23 +108,23 @@ func (w *Tx) Exec(query string, args ...interface{}) (sql.Result, error) { 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() @@ -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() diff --git a/telemetry/attributes.go b/telemetry/attributes.go index c159c06d..233122bb 100644 --- a/telemetry/attributes.go +++ b/telemetry/attributes.go @@ -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: