Pure-Go Race Detector – Race Detection Without CGO

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 image…


This content originally appeared on DEV Community and was authored by Andrey Kolkov

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

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!


This content originally appeared on DEV Community and was authored by Andrey Kolkov


Print Share Comment Cite Upload Translate Updates
APA

Andrey Kolkov | Sciencx (2025-11-28T16:00:28+00:00) Pure-Go Race Detector – Race Detection Without CGO. Retrieved from https://www.scien.cx/2025/11/28/pure-go-race-detector-race-detection-without-cgo/

MLA
" » Pure-Go Race Detector – Race Detection Without CGO." Andrey Kolkov | Sciencx - Friday November 28, 2025, https://www.scien.cx/2025/11/28/pure-go-race-detector-race-detection-without-cgo/
HARVARD
Andrey Kolkov | Sciencx Friday November 28, 2025 » Pure-Go Race Detector – Race Detection Without CGO., viewed ,<https://www.scien.cx/2025/11/28/pure-go-race-detector-race-detection-without-cgo/>
VANCOUVER
Andrey Kolkov | Sciencx - » Pure-Go Race Detector – Race Detection Without CGO. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/11/28/pure-go-race-detector-race-detection-without-cgo/
CHICAGO
" » Pure-Go Race Detector – Race Detection Without CGO." Andrey Kolkov | Sciencx - Accessed . https://www.scien.cx/2025/11/28/pure-go-race-detector-race-detection-without-cgo/
IEEE
" » Pure-Go Race Detector – Race Detection Without CGO." Andrey Kolkov | Sciencx [Online]. Available: https://www.scien.cx/2025/11/28/pure-go-race-detector-race-detection-without-cgo/. [Accessed: ]
rf:citation
» Pure-Go Race Detector – Race Detection Without CGO | Andrey Kolkov | Sciencx | https://www.scien.cx/2025/11/28/pure-go-race-detector-race-detection-without-cgo/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.