@night-codes
Nothing here yet.
Nothing here yet.
No blogs yet.
Sayed Alesawy As far as I understand, in this case sql.Open is just for example, which means there could be any other function with indefinite execution time. I would like to return to the problem stated in paragraph 2 (without init function): ...Consider the case where 2 goroutines are calling the function DBConnection() at the same time. It's possible that the first goroutine reads the value of dbInstance and finds it nil and then proceeds to create a new connection... Does dbOnce.Do block the rest of the function's calls for the execution time, or just let them pass by and return nil?