This question already has an answer here:
- Undefined err variable 1 answer
I am trying to run this - which would work fine in PHP but in Go I am getting an error:
if strings.EqualFold(update_status, "live") {
stmt, err := dbmap.Prepare(
"UPDATE Apps SET version=?,deploy_status=?,status=?,live_date=? WHERE id=?")
} else {
stmt, err := dbmap.Prepare(
"UPDATE Apps SET version=?,deploy_status=?,status=? WHERE id=?")
}
I get the error of controllers/apps.go:1095: undefined: stmt in stmt.Exec
.
How can I change this so it will work?
Thanks
</div>