Oh connection pooling is handled automatically by the standard library ...jk not really, it leaks sometimes ... and ...down ...goes ...my ...production database. 2 weeks ago.
I'm not a fan of Go, but the connection pooling in the standard library doesn't leak. You're just not closing the Rows object if you encounter an error. It automatically closes if you fully iterate through it. But if you stop part way, you have to manually close it or the connection will not be returned to the pool.
Yeah I don't have the code or docs in front of me but I think it was calling db.Query().Scan(&thing) and forgetting to close the row returned by .Query(). I was also using some edgier parts of the sql package without fully understanding a lot it, so I exposed myself quite a bit.
Go is a small language but it's a language with roots in C that many people (myself included) don't understand that well. It's deceptively easy, kind of like picking up Elixir because Ruby without understanding Erlang. Lots of paper cuts.