Consider the code below
tx, err := db.Begin() if err != nil { return err } stmt, err := tx.Prepare(MY_STATEMENT) if err != nil { tx.Rollback() return