mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
fix: resolve data race in token.RNG global
Wrap *rand.Rand in a mutex-protected SafeRand type to make the global RNG safe for concurrent use across goroutines. The previous bare *rand.Rand caused data races detected by go test -race.
This commit is contained in:
@@ -539,7 +539,7 @@ func TestDiffItemStacks_GeneratesNewWarehouseID(t *testing.T) {
|
||||
}
|
||||
|
||||
// Reset RNG for consistent test
|
||||
token.RNG = token.NewRNG()
|
||||
token.RNG = token.NewSafeRand()
|
||||
|
||||
result := DiffItemStacks(old, update)
|
||||
if len(result) != 1 {
|
||||
|
||||
Reference in New Issue
Block a user