refactor: replace hardcoded NATS subjects with typed helpers
Some checks failed
CI / Deploy / test (pull_request) Successful in 14s
CI / Deploy / lint (pull_request) Failing after 21s
CI / Deploy / deploy (pull_request) Has been skipped

Add GameSubject/ChatSubject helpers to connect4 and snake packages,
eliminating magic string concatenation from handlers and main.go.
This commit is contained in:
Ryan Hamamura
2026-03-02 21:30:47 -10:00
parent 2cfd42b606
commit fb6c0e3d90
5 changed files with 20 additions and 8 deletions

View File

@@ -7,6 +7,12 @@ import (
"github.com/ryanhamamura/games/player"
)
// NATS subject helpers.
const SubjectPrefix = "snake"
func GameSubject(gameID string) string { return SubjectPrefix + "." + gameID }
func ChatSubject(gameID string) string { return SubjectPrefix + ".chat." + gameID }
type Direction int
const (