Skip to content

RegisterDial is not safe to call from multiple goroutines #772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zombiezen opened this issue Mar 27, 2018 · 0 comments
Closed

RegisterDial is not safe to call from multiple goroutines #772

zombiezen opened this issue Mar 27, 2018 · 0 comments

Comments

@zombiezen
Copy link
Contributor

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", /* ... */)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant