Skip to content

Conversation

@raeperd
Copy link
Owner

@raeperd raeperd commented Oct 12, 2025

Issue

Data race in when multiple concurrent requests modify shared field.

Fix

  • Rename →
  • Create copy of for each request
  • Modify copy instead of shared variable

Verification

✓ All tests pass with race detection (go test -shuffle=on -race -coverprofile=coverage.txt ./...
ok github.com/raeperd/kickstart.go 1.255s coverage: 80.0% of statements)
✓ Coverage: 80.0%

Create a copy of baseRes for each request instead of modifying the
shared variable. The data race occurred when multiple concurrent
requests modified res.Uptime simultaneously.

All tests pass with race detection enabled.
@raeperd raeperd merged commit 7905112 into main Oct 22, 2025
4 checks passed
@raeperd raeperd deleted the fix-health-handler-data-race branch October 22, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants