go-sql-driver/mysql — pull request #219 by arnehormann (2014-03-13 10:30:25+00:00)
Title: return first err in mysqlConn.Close

fixes #218

Usually, `Close()` is not a problem. Recovering from it is next to impossible anyway.
Every returned error in the driver itself is replaced with `driver.ErrBadConn`, so the error is not even used in the driver (I only checked packets.go and connection.go, but still...).
In `database/sql`, the error is ignored everywhere except in a call to `finalClose`, which apparently is *never* called.

Please check this, it's pretty weird and should probably be a golang issue:
* open [`database/sql/sql.go`](http://golang.org/src/pkg/database/sql/sql.go) (the other file, `convert.go`, is irrelevant in this regard)
* search for `driver.Conn` - it's only used in `driverConn`, variable name `ci`
* search for `ci.Close()` - three usages, only one in `finalClose()` stores the error
* search for `finalClose(` - it's not exported and never called?!?

But we export the driver which exposes the possibility to call `Close()` directly and the error should be preserved.