Merge branch 'master' of github.com:gojp/goreportcard

This commit is contained in:
Herman Schaaf
2016-02-15 19:17:27 +08:00
2 changed files with 9 additions and 7 deletions

View File

@@ -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)

View File

@@ -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 {