Skip to content

RegisterDial is not safe to call from multiple goroutines #772

Closed
@zombiezen

Description

@zombiezen

Issue description

As the subject implies, RegisterDial is not safe to call from multiple goroutines.

func RegisterDial(net string, dial DialFunc) {

Example code

var wg sync.WaitGroup
wg.Add(1)
go func() {
  mysql.RegisterDial("dial1", func(string) (net.Conn, error) { return nil, errors.New("bork") })
  wg.Done()
}()
go func() {
  mysql.RegisterDial("dial2", func(string) (net.Conn, error) { return nil, errors.New("bork") })
  wg.Done()
}()
wg.Wait()
sql.Open("mysql", /* ... */)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions