func (g *GameService) Stat(w http.ResponseWriter, r *http.Request) { err := r.ParseForm() if err != nil { http.Error(w, "parse error", 405) } wid := r.Form.Get("worldid") worldid, err := strconv.ParseInt(wid, 0, 64) //log.Printf("worldid %v, %v", worldid, err) if err != nil { ws := make(map[int64]string, len(g.Worlds)) for id, w := range g.Worlds { ws[id] = w.String() } TopHtmlTemplate.Execute(w, struct { Disp string Worlds map[int64]string }{ Disp: g.String(), Worlds: ws, }) } else { if g.Worlds[worldid] != nil { wi := g.Worlds[worldid].makeWorldInfoWeb() WorldHtmlTemplate.Execute(w, wi) } } }