Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
database/sql: Why is errDBClosed not exported? #9947
When I close a database connection and then try to execute a query on it, I get
Why is this variable not exported? It can be useful to do something like this:
The cost of exporting this variable is nothing.
I'll explain my specific use case, so it is not so abstract.
I run a cooking process periodically on a separate goroutine. Occasionally this fails because of transaction locks, etc. My default behavior is to simply log the error and then retry during the next cook period.
When the program is asked to stop, I issue a
The current way I deal with it is to wrap
Specifically I wouldn't return a nil instead of an error. The code looks more like this (or would look like this if
My reading of the
You might try something like this, where all your workers can select on a timer or a
I'm certainly not arguing that there is no other way around this problem.
My question simply was, why is errDBClosed not exported?
Edit: Specifically, it seems to have been created with this commit:
It looks like prior to this, the error was being reported using