Skip to content

Commit

Permalink
add explicit initialization of fields of structures in sql.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kozyrev-m committed Apr 24, 2024
1 parent 85b78ec commit 3282eff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"database/sql"
"database/sql/driver"
"fmt"
"sync"

"github.com/ydb-platform/ydb-go-sdk/v3/internal/bind"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
Expand All @@ -15,7 +16,10 @@ import (
"github.com/ydb-platform/ydb-go-sdk/v3/trace"
)

var d = &sqlDriver{connectors: make(map[*xsql.Connector]*Driver)} //nolint:gochecknoglobals
var d = &sqlDriver{
connectors: make(map[*xsql.Connector]*Driver),
connectorsMtx: xsync.RWMutex{RWMutex: sync.RWMutex{}},
} //nolint:gochecknoglobals

func init() { //nolint:gochecknoinits
sql.Register("ydb", d)
Expand All @@ -28,8 +32,8 @@ type sqlDriver struct {
}

var (
_ driver.Driver = &sqlDriver{}
_ driver.DriverContext = &sqlDriver{}
_ driver.Driver = &sqlDriver{connectors: nil, connectorsMtx: xsync.RWMutex{RWMutex: sync.RWMutex{}}}
_ driver.DriverContext = &sqlDriver{connectors: nil, connectorsMtx: xsync.RWMutex{RWMutex: sync.RWMutex{}}}
)

func (d *sqlDriver) Close() error {
Expand Down

0 comments on commit 3282eff

Please sign in to comment.