From 99fd8a9cf96a51fcd9e50445cb035cc9ecd012de Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 22 Mar 2025 13:44:03 +0800 Subject: Variable name lengths --- http_handle_repo_contrib_index.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'http_handle_repo_contrib_index.go') diff --git a/http_handle_repo_contrib_index.go b/http_handle_repo_contrib_index.go index 41c4d18..af3f8b6 100644 --- a/http_handle_repo_contrib_index.go +++ b/http_handle_repo_contrib_index.go @@ -15,34 +15,34 @@ type idTitleStatus struct { Status string } -func httpHandleRepoContribIndex(w http.ResponseWriter, r *http.Request, params map[string]any) { +func httpHandleRepoContribIndex(writer http.ResponseWriter, request *http.Request, params map[string]any) { var rows pgx.Rows var result []idTitleStatus var err error - if rows, err = database.Query(r.Context(), + if rows, err = database.Query(request.Context(), "SELECT id, COALESCE(title, 'Untitled'), status FROM merge_requests WHERE repo_id = $1", params["repo_id"], ); err != nil { - http.Error(w, "Error querying merge requests: "+err.Error(), http.StatusInternalServerError) + http.Error(writer, "Error querying merge requests: "+err.Error(), http.StatusInternalServerError) return } defer rows.Close() for rows.Next() { - var id int - var title, status string - if err = rows.Scan(&id, &title, &status); err != nil { - http.Error(w, "Error scanning merge request: "+err.Error(), http.StatusInternalServerError) + var mrID int + var mrTitle, mrStatus string + if err = rows.Scan(&mrID, &mrTitle, &mrStatus); err != nil { + http.Error(writer, "Error scanning merge request: "+err.Error(), http.StatusInternalServerError) return } - result = append(result, idTitleStatus{id, title, status}) + result = append(result, idTitleStatus{mrID, mrTitle, mrStatus}) } if err = rows.Err(); err != nil { - http.Error(w, "Error ranging over merge requests: "+err.Error(), http.StatusInternalServerError) + http.Error(writer, "Error ranging over merge requests: "+err.Error(), http.StatusInternalServerError) return } params["merge_requests"] = result - renderTemplate(w, "repo_contrib_index", params) + renderTemplate(writer, "repo_contrib_index", params) } -- cgit v1.2.3