From bf853880cae144ae423d0d878d41708a7094ddeb Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Sat, 7 Sep 2013 19:12:46 -0700 Subject: [PATCH] go fmt --- game.go | 1 - http.go | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/game.go b/game.go index ac923ab..d32e1cc 100644 --- a/game.go +++ b/game.go @@ -88,7 +88,6 @@ func (g *game) run() { robots_remaining++ p.scan(g.players) p.nudge() - // XXX: change to pointer, check for pointer as (0, 0) is valid target if p.Robot.FireAt != nil { proj := p.fire(g.projectiles) if proj != nil { diff --git a/http.go b/http.go index d1240f1..21aa190 100644 --- a/http.go +++ b/http.go @@ -33,21 +33,21 @@ func startGame(w http.ResponseWriter, req *http.Request) { func listGames(w http.ResponseWriter, req *http.Request) { games.RLock() defer games.RUnlock() - type gl struct { - Id string `json:"id"` - Players []string `json:"players"` - } + type gl struct { + Id string `json:"id"` + Players []string `json:"players"` + } ids := make([]gl, 0) for id, g := range games.m { - players := make([]string, 0) - for p, _ := range g.players { - // XXX: change this to be the user-provided bot name? - players = append(players, p.Robot.Id) - } + players := make([]string, 0) + for p, _ := range g.players { + // XXX: change this to be the user-provided bot name? + players = append(players, p.Robot.Id) + } ids = append(ids, gl{ - Id: id, - Players: players, - }) + Id: id, + Players: players, + }) } if err := json.NewEncoder(w).Encode(ids); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError)