Categorygithub.com/o2lab/go2
module
0.0.0-20220711204832-fc2ec5cd5d45
Repository: https://github.com/o2lab/go2.git
Documentation: pkg.go.dev

# README

GoRace Detector

Build and install the tool

Make sure Go is installed in the system. In go2/gorace, execute

go build

Dependencies will be automatically downloaded. By default, the built artifact is named gorace.

Install the tool in the PATH by executing

go install

Configuration

Update the gorace.yml file (located under go2/gorace) with your preferred config options and place it under the directory where gorace will be executed at.

Running the tool

Use the -show flag to show call stack of racy accesses.

gorace -show ./

Running on gRPC

After installing race-checker, go to the root directory of the gRPC repo,

Execute race-checker in the main directory of a Go program, followed by the path with which to start analysis from,

gorace ./

or

gorace ./examples/helloworld/greeter_client

When multiple entry points are identified like shown below,

Image of screenshot

gorace will request your input for which entry-points to analyze,

Image of screenshot

For example, if you would like to analyze entry points 1 to 20, just enter 1-20

or if you would like to analyze the entry point google.golang.org/grpc/examples/helloworld/greeter_client, just enter 44 as shown in screenshot above.

or use the -analyzeAll flag since the very beginning if trying to run all entry points,

gorace -analyzeAll ./

# Packages

Testing method callspackage main import ( "fmt") type someData struct { someInt int} var xtoy = make(chan int) func (someNum someData) justRecv() int { k := <-xtoy close(xtoy) return k} func (someNum someData) justSend() { xtoy <- someNum.someInt} func main() { x2 := someData{someInt: 5} var j int go func() { x2.someInt = 2 * x2.someInt x2.justSend() }() go func() { j = x2.justRecv() fmt.Println(j) }()}.