此内容没有您所选择的语言版本。
Chapter 4. The Go race detector
Go Toolset includes the Go race detector, which is a tool of the Go standard library for finding race conditions. Note that the race detector has a significant runtime resource overhead.
4.1. Prerequisites 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
4.2. Using the Go race detector 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Use the Go race detector to check your code for race conditions.
Procedure
Use the race detector:
go build -race -o <output_file> <go_main_package>
# go build -race -o <output_file> <go_main_package>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<output_file>with the name of your executable file and<go_main_package>with the name of the package you want to test.