I have package where I write a golang
code. I have a fear that program works incorrecly because it outputs different results from time to time. Probably it's due to race condtions
. So I run multiple times:
go run -race myprogram
But I didn't got any warning or errros.
Probably, errors are in another package I imported. As I understand, -race
flag doesn't detect them. If so, how can I do it (detect race condtion which occurs not in my code but in package I imported and I use in my code)?
The race condition detection is false negative rather than false positive. This means that it detects race at any time when it has just happened - when a program tries to read or write a shared value at the same time. The bottom line is the -race flag works not at 100% cases.