Detect data races in Go programs
Find data race conditions in concurrent Go programs on Red Hat Enterprise Linux by using the Go race detector in Go Toolset. The race detector reports unsafe memory access between goroutines at runtime. Note that the race detector introduces significant runtime overhead.
Prerequisites Copy linkLink copied!
- Go Toolset is installed.
Use the Go race detector Copy linkLink copied!
Use the Go race detector to check your code for race conditions.
Procedure Copy linkLink copied!
# go build -race -o <output_file><go_main_package>
Replace <output_file> with the name of your executable file and <go_main_package> with the name of the package you want to test.