diff --git a/handlers.go b/handlers.go index a85f67e..c8591bc 100644 --- a/handlers.go +++ b/handlers.go @@ -105,13 +105,13 @@ func attempt(w http.ResponseWriter, req *http.Request) { session, _ := store.Get(req, "Score") score := getScore(session) - if result { - score += 1 - } else { - score -= 1 - } - session.Values["Score"] = score - session.Save(req, w) + if result { + score += 1 + } else { + score -= 1 + } + session.Values["Score"] = score + session.Save(req, w) b, err := json.Marshal(solution{result, score}) if err != nil { diff --git a/main.go b/main.go index fe24991..9172626 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,9 @@ import ( "flag" "github.com/gorilla/sessions" "log" + "math/rand" "net/http" - "math/rand" - "time" + "time" ) const MAX = 12 @@ -17,12 +17,12 @@ var static_files = flag.String("static", "./static", "location of static files") var store = sessions.NewCookieStore([]byte("hello world")) func main() { - rand.Seed( time.Now().UTC().UnixNano()) + rand.Seed(time.Now().UTC().UnixNano()) flag.Parse() http.Handle("/", http.FileServer(http.Dir(*static_files))) - http.Handle("/api/v0/problem/", JsonHandler(problem)) - http.Handle("/api/v0/attempt/", JsonHandler(attempt)) + http.Handle("/api/v0/problem/", JsonHandler(problem)) + http.Handle("/api/v0/attempt/", JsonHandler(attempt)) if err := http.ListenAndServe(*addr, nil); err != nil { log.Fatal("ListenAndServe:", err) }