code: func rollbackOnPanic(tx *transaction) {
  	if err := recover(); err != nil {
  		tx.managed = false
  		_ = tx.Rollback()
  		panic(err)
  	}
  }
docs: // rollbackOnPanic rolls the passed transaction back if the code in the calling
  // function panics.  This is needed since the mutex on a transaction must be
  // released and a panic in called code would prevent that from happening.
  //
  // NOTE: This can only be handled manually for managed transactions since they
  // control the life-cycle of the transaction.  As the documentation on Begin
  // calls out, callers opting to use manual transactions will have to ensure the
  // transaction is rolled back on panic if it desires that functionality as well
  // or the database will fail to close since the read-lock will never be
  // released.