In go, I can enable the race detector for tests using the -race option e.g.
go test -race ./foo/bar
How do I do this in bazel?
In go, I can enable the race detector for tests using the -race option e.g.
go test -race ./foo/bar
How do I do this in bazel?
Use --@io_bazel_rules_go//go/config:race (docs) as a flag to bazel test.
--features=race is no longer supported and the test will warn about not being supported.
bazel test --@io_bazel_rules_go//go/config:race //src/foo/bar
As of https://github.com/bazelbuild/rules_go/pull/635, you can run bazel tests using the option --features race to provide the -race flag to go tests. e.g.
bazel test --features race //src/foo/bar