Removed pointless error checking

This commit is contained in:
2023-07-21 18:36:34 +01:00
parent d5cae327f3
commit 5d2aba9caa

View File

@@ -63,8 +63,7 @@ func login(c *gin.Context) {
// check for user using given credentials // check for user using given credentials
stmt, err := db.Prepare("SELECT * FROM users WHERE name=?") stmt, err := db.Prepare("SELECT * FROM users WHERE name=?")
checkErr(err) checkErr(err)
err = stmt.Close() defer stmt.Close()
checkErr(err)
var user loginOutput var user loginOutput
err = stmt.QueryRow(userData.Name).Scan(&user.UID, &user.Name, &user.Password, &user.Role) err = stmt.QueryRow(userData.Name).Scan(&user.UID, &user.Name, &user.Password, &user.Role)
if err != nil { if err != nil {
@@ -100,8 +99,7 @@ func getTasks(c *gin.Context) {
} }
tasks = append(tasks, tempTask) tasks = append(tasks, tempTask)
} }
err = rows.Close() rows.Close()
checkErr(err)
var jsonTasks taskArray var jsonTasks taskArray
jsonTasks.Tasks = tasks jsonTasks.Tasks = tasks
c.IndentedJSON(http.StatusOK, jsonTasks) c.IndentedJSON(http.StatusOK, jsonTasks)
@@ -143,8 +141,7 @@ func getHistory(c *gin.Context) {
} }
history = append(history, tempHistoryData) history = append(history, tempHistoryData)
} }
err = rows.Close() rows.Close()
checkErr(err)
var historyRes []historyResData var historyRes []historyResData
// make the data human-readable // make the data human-readable