2025 update: This is now possible.
I've built a Pure-Go race detector that works with CGO_ENABLED=0:
https://github.com/kolkov/racedetector
Works in:
- Alpine/scratch Docker containers
- AWS Lambda / Cloud Functions
- Cross-compilation scenarios
- Any CGO_ENABLED=0 environment
Usage:
go install github.com/kolkov/racedetector/cmd/racedetector@latest
racedetector build -o myapp main.go
It's a standalone tool (not runtime integration yet), but it detects
races without any CGO dependency. FastTrack algorithm, 15-22% overhead,
pure Go.
Feedback welcome: https://github.com/kolkov/racedetector/discussions
Best regards!
On Wednesday, 18 February 2015 at 00:09:22 UTC+3 Blake Caldwell wrote:
I'm building my service without CGO, so ideally, I'd like to run my tests
with the same settings, and I really like race detection. Is there any way
to use the race detector with CGO_ENABLED=0?
# testmain
runtime/race(.text): __libc_malloc: not defined
runtime/race(.text): getuid: not defined
runtime/race(.text): pthread_self: not defined
runtime/race(.text): madvise: not defined
runtime/race(.text): sleep: not defined
runtime/race(.text): usleep: not defined
runtime/race(.text): abort: not defined
runtime/race(.text): isatty: not defined
runtime/race(.text): __libc_free: not defined
runtime/race(.text): getrlimit: not defined
runtime/race(.text): __libc_stack_end: not defined
runtime/race(.text): getrlimit: not defined
runtime/race(.text): setrlimit: not defined
runtime/race(.text): setrlimit: not defined
runtime/race(.text): setrlimit: not defined
runtime/race(.text): exit: not defined
runtime/race(.text.unlikely): __errno_location: not defined
runtime/race(.text): undefined: __libc_malloc
runtime/race(.text): undefined: getuid
runtime/race(.text): undefined: pthread_self
runtime/race(.text): undefined: madvise
too many errors
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/cce76d7a-e076-4d62-9c89-d9e2788d74b0n%40googlegroups.com.