1
0
Fork 0

Fix syntax consistency

This commit is contained in:
Gregory Eremin 2014-07-17 02:18:54 +07:00
parent 0339b45090
commit eb4e6e8772
2 changed files with 9 additions and 8 deletions

View File

@ -24,16 +24,16 @@ func StatusHandler(w http.ResponseWriter, r *http.Request) {
}
}
infoJson, _ := json.Marshal(info)
w.Write(infoJson)
jsn, _ := json.Marshal(info)
w.Write(jsn)
}
func DebugHandler(w http.ResponseWriter, r *http.Request) {
info := make(map[string]int)
info["goroutines"] = runtime.NumGoroutine()
infoJson, _ := json.Marshal(info)
w.Write(infoJson)
jsn, _ := json.Marshal(info)
w.Write(jsn)
}
func PublishHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -24,9 +24,9 @@ func SaveState() {
}
}
stateJson, _ := json.Marshal(state)
jsn, _ := json.Marshal(state)
key := Key(StateMetaKey)
if err := storage.Set(key, stateJson); err != nil {
if err := storage.Set(key, jsn); err != nil {
Error(err, "Failed to persist state")
return
}
@ -36,13 +36,14 @@ func LoadState() {
state := make(ServerState)
key := Key(StateMetaKey)
stateJson, err := storage.Get(key)
jsn, err := storage.Get(key)
if err != nil {
Log("State not found")
return
}
if err := json.Unmarshal(stateJson, &state); err != nil {
err = json.Unmarshal(jsn, &state)
if err != nil {
Log("Failed to load state")
return
}