Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run a go test using bazel with the -race option?

Tags:

go

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?

like image 514
Charles Ma Avatar asked Oct 18 '25 00:10

Charles Ma


1 Answers

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
like image 52
Charles Ma Avatar answered Oct 20 '25 13:10

Charles Ma