简体   繁体   English

如何使用带有 -race 选项的 bazel 运行 go 测试?

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

In go, I can enable the race detector for tests using the -race option eg在 go 中,我可以使用-race选项启用竞态检测器进行测试,例如

go test -race./foo/bar

How do I do this in bazel?我如何在巴泽尔中做到这一点?

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.https://github.com/bazelbuild/rules_go/pull/635 开始,您可以使用选项--features race运行 bazel 测试,为 go 测试提供-race标志。 eg例如

bazel test --features race //src/foo/bar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM