I'm more concerned by the more general failing of the Go SQL API, that it doesn't seem to allow sessions outside of sql.Tx.
I keep running into a (perceived?) problem with the go database/sql package. A lot (all?) databases have a concept of a database session. But the database/sql package makes no guarantee that two consecutive DB.Exec/Query will be executed in the same database session. I don't see how they can make that guarantee either, e.g. if the connection is lost between the two queries.
Why do you need such sessions?
If you need to have an other transaction isolation level than the MySQL
server default, you should specify that directly in the Data Source Name.
The same holds for any other MySQL session variable.
E.g. with github.com/go-sql-driver/mysql, you could use
"username:password@tcp(hostname)/dbname?tx_isolation=REPEATABLE-READ"
as DSN. See https://github.com/go-sql-driver/mysql#system-variables .
Other MySQL drivers should offer similar mechanisms.