From 5be46ca55aee62739689c25930770c1c33d7ca99 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 13 Nov 2019 20:46:02 +0000 Subject: [PATCH] go fmt --- src/handlers.go | 2 +- src/instance.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/handlers.go b/src/handlers.go index a699223..4480787 100644 --- a/src/handlers.go +++ b/src/handlers.go @@ -103,7 +103,7 @@ func (ctx *Instance) answerHandler(w http.ResponseWriter, req *http.Request) { pointstr := req.FormValue("points") answer := req.FormValue("answer") - if ! ctx.ValidTeamId(teamId) { + if !ctx.ValidTeamId(teamId) { respond( w, req, JSendFail, "Invalid team ID", diff --git a/src/instance.go b/src/instance.go index 1d3a26f..0f0aab4 100644 --- a/src/instance.go +++ b/src/instance.go @@ -28,7 +28,7 @@ type Instance struct { jPointsLog []byte nextAttempt map[string]time.Time nextAttemptMutex *sync.RWMutex - mux *http.ServeMux + mux *http.ServeMux } func (ctx *Instance) Initialize() error { @@ -132,15 +132,15 @@ func (ctx *Instance) ThemePath(parts ...string) string { func (ctx *Instance) TooFast(teamId string) bool { now := time.Now() - + ctx.nextAttemptMutex.RLock() next, _ := ctx.nextAttempt[teamId] ctx.nextAttemptMutex.RUnlock() - + ctx.nextAttemptMutex.Lock() ctx.nextAttempt[teamId] = now.Add(ctx.AttemptInterval) ctx.nextAttemptMutex.Unlock() - + return now.Before(next) }