Hi!
I've been working on a pure-Go race detector that works without CGO. Just released v0.3.0 with major performance improvements.
The Problem
Go's built-in race detector requires CGO. This means:
- No race detection in Docker scratch images
- Cross-compilation becomes complicated
- Cloud functions and embedded systems are out of luck
The Solution
A pure-Go implementation of race detection using the FastTrack algorithm. Works with CGO_ENABLED=0.
What's New in v0.3.0
99% overhead reduction - from ~10,000x down to ~100x slowdown.
Key improvements:
- Adaptive Sampling - configurable 1-100% sample rate for production use
- Sparse VectorClocks - O(active goroutines) instead of O(total)
- Address Compression - 8x memory reduction
- 4 Inline Slots - zero allocations for common cases
Installation
go install github.com/kolkov/racedetector/cmd/racedetector@v0.3.0
Usage
# Build with race detection
racedetector build -o myapp main.go
# Run with race detection
racedetector run main.go
# Production with 10% sampling
RACEDETECTOR_SAMPLE_RATE=10 racedetector run main.go
Links
- GitHub: https://github.com/kolkov/racedetector
- Discussions: https://github.com/kolkov/racedetector/discussions
- Issues: https://github.com/kolkov/racedetector/issues
Looking for Feedback
I'd appreciate if you could try it on your projects and report any bugs or false positives. Contributions are welcome.
Also curious: should something like this be proposed for Go toolchain integration, or is it better as a standalone tool?
Thanks!
Top comments (0)