mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-29 06:49:05 +08:00
Merge branch 'master' of github.com:gojp/goreportcard
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user