You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a code that needs to know whether the application runs with the race detector or not. In a way that is similar to testing.Verbose() tells whether -verbose flag is used.
My version
go version go1.17.1 linux/amd64
I have a code that needs to know whether the application runs with the race detector or not. In a way that is similar to
testing.Verbose()
tells whether-verbose
flag is used.I looked at public runtime library and did not find any method that allows to get information about the race detector. There is a SO question about it https://stackoverflow.com/questions/44944959/how-can-i-check-if-the-race-detector-is-enabled-at-runtime and it proposes a solution that uses buildtags. And there are many uses who follows this approach.
But it would be better if golang runtime library provided a cleaner way to find out if the race detector is enabled.
The text was updated successfully, but these errors were encountered: