IssueRaiser

proposal: runtime/race: Pure-Go implementation without CGO dependency

This proposal addresses the long-standing request for a race detector that works with `CGO_ENABLED=0`. **Related issues:** - #9918 - race: runtime depends on libc (opened by @dvyukov, 2014, still open) - #6508 - runtime/race: can't be used with CGO_ENABLED=0 (2013) - #38955 - race detector should not require cgo (2020, closed as duplicate) ## Background The current race detector requires ThreadSanitizer (C++), which creates several limitations: - `CGO_ENABLED=1` is mandatory - Cannot produce static binaries for `FROM scratch` Docker containers - Cross-compilation requires target platform libc - Platform-specific allocation failures (#37651, #29948, #67881) Issue #9918 has been open for 11 years with "Unplanned" milestone. The solution proposed there — "eliminate all libc dependencies from race runtime" — is what this implementation provides. ## Implementation I've implemented a pure-Go race detector based on peer-reviewed algorithms: | Algorithm | Paper | Contribution | |-----------|-------|--------------| | **FastTrack** | PLDI 2009 | Core happens-before detection | | **BigFoot** | PLDI 2017 | Static coalescing (90% barrier reduction) | | **SmartTrack** | PLDI 2020 | Ownership tracking (10-20% faster) | | **O(1) Sampling** | PLDI 2024 | Probabilistic sampling for CI/CD | **Current status (v0.7.0):** - 359/359 tests from Go's official race test suite passing - Works with `CGO_ENABLED=0` - Standalone CLI tool: `racedetector build/run/test` - All Go platforms supported

Posted by kolkov on Dec 11, 2025, 12:50 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

github (Software)

proposal: runtime/race: Pure-Go implementation without CGO dependency

kolkovDec 11, 2025, 12:50 AM

This proposal addresses the long-standing request for a race detector that works with `CGO_ENABLED=0`. **Related issues:** - #9918 - race: runtime depends on libc (opened by @dvyukov, 2014, still open) - #6508 - runtime/race: can't be used with CGO_ENABLED=0 (2013) - #38955 - race detector should not require cgo (2020, closed as duplicate) ## Background The current race detector requires ThreadSanitizer (C++), which creates several limitations: - `CGO_ENABLED=1` is mandatory - Cannot produce static binaries for `FROM scratch` Docker containers - Cross-compilation requires target platform libc - Platform-specific allocation failures (#37651, #29948, #67881) Issue #9918 has been open for 11 years with "Unplanned" milestone. The solution proposed there — "eliminate all libc dependencies from race runtime" — is what this implementation provides. ## Implementation I've implemented a pure-Go race detector based on peer-reviewed algorithms: | Algorithm | Paper | Contribution | |-----------|-------|--------------| | **FastTrack** | PLDI 2009 | Core happens-before detection | | **BigFoot** | PLDI 2017 | Static coalescing (90% barrier reduction) | | **SmartTrack** | PLDI 2020 | Ownership tracking (10-20% faster) | | **O(1) Sampling** | PLDI 2024 | Probabilistic sampling for CI/CD | **Current status (v0.7.0):** - 359/359 tests from Go's official race test suite passing - Works with `CGO_ENABLED=0` - Standalone CLI tool: `racedetector build/run/test` - All Go platforms supported

Comments (0)

No comments yet. Start the discussion.

Comment on this issue