README.md 741 Bytes
Newer Older
Juan Batiz-Benet's avatar
v1  
Juan Batiz-Benet committed
1 2 3 4 5 6
# go-detect-race

Check if the race detector is running.

I didnt find a variable to check quickly enough so I made this.

Steven Allen's avatar
Steven Allen committed
7 8 9
## Lead Maintainer

[Steven Allen](https://github.com/Stebalien)
Juan Batiz-Benet's avatar
v1  
Juan Batiz-Benet committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

## Usage

```go
import (
  detectrace "github.com/jbenet/go-detect-race"
)

func main() {
  if detectrace.WithRace() {
    // running with -race
  } else {
    // running without -race
  }
}
```
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
26 27 28 29 30 31 32 33 34 35 36

## Why?

Because the race detector doesnt like massive stress tests. Example:
https://groups.google.com/forum/#!topic/golang-nuts/XDPHUt2LE70

## Why didn't you just use...

Please tell me about a better way of doing this. It wasn't
readily apparent to me, so I made this. But i would much prefer
an env var or some already existing var from the stdlib :)