aboutsummaryrefslogtreecommitdiff
path: root/http_handle_index.go
diff options
context:
space:
mode:
Diffstat (limited to 'http_handle_index.go')
-rw-r--r--http_handle_index.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/http_handle_index.go b/http_handle_index.go
index 4448272..bbb10d8 100644
--- a/http_handle_index.go
+++ b/http_handle_index.go
@@ -1,13 +1,14 @@
package main
import (
+ "fmt"
"net/http"
)
func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any) {
rows, err := database.Query(r.Context(), "SELECT name FROM groups")
if err != nil {
- _, _ = w.Write([]byte("Error querying groups: " + err.Error()))
+ fmt.Fprintln(w, "Error querying groups: " + err.Error())
return
}
defer rows.Close()
@@ -16,14 +17,14 @@ func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any)
for rows.Next() {
var groupName string
if err := rows.Scan(&groupName); err != nil {
- _, _ = w.Write([]byte("Error scanning group name: " + err.Error()))
+ fmt.Fprintln(w, "Error scanning group name: " + err.Error())
return
}
groups = append(groups, groupName)
}
if err := rows.Err(); err != nil {
- _, _ = w.Write([]byte("Error iterating over rows: " + err.Error()))
+ fmt.Fprintln(w, "Error iterating over rows: " + err.Error())
return
}
@@ -31,7 +32,7 @@ func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any)
err = templates.ExecuteTemplate(w, "index", params)
if err != nil {
- _, _ = w.Write([]byte("Error rendering template: " + err.Error()))
+ fmt.Fprintln(w, "Error rendering template: " + err.Error())
return
}
}