-
Notifications
You must be signed in to change notification settings - Fork 18k
database/sql: Stmt.Close() seem to ignore the error #37973
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
Comments
Thank you for reporting this bug @Sergey1011010 and welcome to the Go project! Kindly paging @kardianos to take a look. |
@Sergey1011010 Thanks for the report.
A better design I think would be to separate out the Stmt from the stmt pool concept. But that would be impossible util a |
@kardianos, many thanks for the explanation. If I use not pool, but real connection, the error does happen.
Not sure how to make a real driver produce an error on Close statement. |
I think I can consider this a limitation of the current design, that may be worked around by using an explicit Conn. If you agree, please close. |
OP probably agrees, I guess. Anyway no news for about a year, I think we can archive this. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
run this code https://play.golang.org/p/hiITqzSJ5O4
What did you expect to see?
panic because of error
What did you see instead?
nothing
Comments
It seems that the issue is not in go-sqlmock, but in go because I run the debugger and found this function https://github.com/golang/go/blob/master/src/database/sql/sql.go#L2701 being called and it returns
nil
and ignores error inv.ds.closeErr
The text was updated successfully, but these errors were encountered: