diff --git a/handlers/check.go b/handlers/check.go index b7ab93d..549e45d 100644 --- a/handlers/check.go +++ b/handlers/check.go @@ -125,9 +125,9 @@ func CheckHandler(w http.ResponseWriter, r *http.Request) { } } - b, marshalErr := json.Marshal(map[string]string{"redirect": "/report/" + repo}) - if marshalErr != nil { - log.Println("JSON marshal error:", marshalErr) + b, err := json.Marshal(map[string]string{"redirect": "/report/" + repo}) + if err != nil { + log.Println("JSON marshal error:", err) } w.WriteHeader(http.StatusOK) w.Write(b) diff --git a/handlers/high_scores.go b/handlers/high_scores.go index 5327e1c..f6cd6db 100644 --- a/handlers/high_scores.go +++ b/handlers/high_scores.go @@ -39,7 +39,10 @@ func HighScoresHandler(w http.ResponseWriter, r *http.Request) { } scoreBytes := hsb.Get([]byte("scores")) if scoreBytes == nil { - scoreBytes, _ = json.Marshal([]scoreHeap{}) + scoreBytes, err = json.Marshal([]scoreHeap{}) + if err != nil { + return err + } } json.Unmarshal(scoreBytes, scores) @@ -48,10 +51,9 @@ func HighScoresHandler(w http.ResponseWriter, r *http.Request) { total := hsb.Get([]byte("total_repos")) if total == nil { count = 0 - } else { - json.Unmarshal(total, &count) + return nil } - return nil + return json.Unmarshal(total, &count) }) if err != nil {