From 3374cb0fb2ce024eb5da78dc63c7313db8ec4c95 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 5 Apr 2025 16:51:55 +0300 Subject: refactor: fix variable declaration and remove duplicate code --- internal/handlers/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'internal/handlers/main.go') diff --git a/internal/handlers/main.go b/internal/handlers/main.go index f0225f6..abd2226 100644 --- a/internal/handlers/main.go +++ b/internal/handlers/main.go @@ -135,7 +135,7 @@ func (h *Handlers) renderQuestion(w http.ResponseWriter, question *models.Questi *models.Question ShowNext bool } - + err = tmpl.ExecuteTemplate(w, "main", &TemplateData{ Question: question, ShowNext: h.showNext, @@ -143,8 +143,7 @@ func (h *Handlers) renderQuestion(w http.ResponseWriter, question *models.Questi if err != nil { h.log.Error("failed to render template", "error", err) } -} - question, err := h.repo.DBGetQuestion("1") + question, err = h.repo.DBGetQuestion("1") if err != nil { h.log.Error("failed to get question", "error", err) abortWithError(w, "Question not found") -- cgit v1.2.3