pkg/flag/flag.go exposes mutable package-level variables (Token, Host, Port, Mode, Debug, Insecure, etc.) that are set once at startup but later read concurrently by every tool handler. Tests (e.g. operation/pull/pull_test.go) directly mutate flag.Token, creating data races against any in-flight tool call when go test -race is run alongside the HTTP server.
Suggested direction
Two options:
Lightweight: wrap each global with sync/atomic or a sync.RWMutex and expose Get/Set accessors. Lowest churn.
Cleaner: move config into an immutable Config struct constructed once in cmd/cmd.go and passed via context (matches how the per-request token already flows through pkg/context.TokenContextKey).
Either way: run the test suite with -race in CI to catch regressions.
## Problem
`pkg/flag/flag.go` exposes mutable package-level variables (`Token`, `Host`, `Port`, `Mode`, `Debug`, `Insecure`, etc.) that are set once at startup but later read concurrently by every tool handler. Tests (e.g. `operation/pull/pull_test.go`) directly mutate `flag.Token`, creating data races against any in-flight tool call when `go test -race` is run alongside the HTTP server.
## Suggested direction
Two options:
1. **Lightweight:** wrap each global with sync/atomic or a `sync.RWMutex` and expose `Get`/`Set` accessors. Lowest churn.
2. **Cleaner:** move config into an immutable `Config` struct constructed once in `cmd/cmd.go` and passed via context (matches how the per-request token already flows through `pkg/context.TokenContextKey`).
Either way: run the test suite with `-race` in CI to catch regressions.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
pkg/flag/flag.goexposes mutable package-level variables (Token,Host,Port,Mode,Debug,Insecure, etc.) that are set once at startup but later read concurrently by every tool handler. Tests (e.g.operation/pull/pull_test.go) directly mutateflag.Token, creating data races against any in-flight tool call whengo test -raceis run alongside the HTTP server.Suggested direction
Two options:
sync.RWMutexand exposeGet/Setaccessors. Lowest churn.Configstruct constructed once incmd/cmd.goand passed via context (matches how the per-request token already flows throughpkg/context.TokenContextKey).Either way: run the test suite with
-racein CI to catch regressions.