fix: resolve all linting errors and add SSE compression
- Add brotli compression (level 5) to long-lived SSE event streams (HandleGameEvents, HandleSnakeEvents) to reduce wire payload - Fix all errcheck violations with nolint annotations for best-effort calls - Fix goimports: separate stdlib, third-party, and local import groups - Fix staticcheck: add package comments, use tagged switch - Zero lint issues remaining
This commit is contained in:
@@ -91,7 +91,7 @@ func HandleCreateGame(store *game.GameStore, sessions *scs.SessionManager) http.
|
||||
|
||||
gi := store.Create()
|
||||
sse := datastar.NewSSE(w, r)
|
||||
sse.ExecuteScript(fmt.Sprintf("window.location.href='/game/%s'", gi.ID()))
|
||||
sse.ExecuteScript(fmt.Sprintf("window.location.href='/game/%s'", gi.ID())) //nolint:errcheck
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,10 +104,10 @@ func HandleDeleteGame(store *game.GameStore, sessions *scs.SessionManager) http.
|
||||
return
|
||||
}
|
||||
|
||||
store.Delete(gameID)
|
||||
store.Delete(gameID) //nolint:errcheck
|
||||
|
||||
sse := datastar.NewSSE(w, r)
|
||||
sse.ExecuteScript("window.location.href='/'")
|
||||
sse.ExecuteScript("window.location.href='/'") //nolint:errcheck
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ func HandleCreateSnakeGame(snakeStore *snake.SnakeStore, sessions *scs.SessionMa
|
||||
si := snakeStore.Create(preset.Width, preset.Height, mode, speed)
|
||||
|
||||
sse := datastar.NewSSE(w, r)
|
||||
sse.ExecuteScript(fmt.Sprintf("window.location.href='/snake/%s'", si.ID()))
|
||||
sse.ExecuteScript(fmt.Sprintf("window.location.href='/snake/%s'", si.ID())) //nolint:errcheck
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,6 @@ func HandleLogout(sessions *scs.SessionManager) http.HandlerFunc {
|
||||
}
|
||||
|
||||
sse := datastar.NewSSE(w, r)
|
||||
sse.ExecuteScript("window.location.href='/'")
|
||||
sse.ExecuteScript("window.location.href='/'") //nolint:errcheck
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user