检查测试是否能够编译通过,而无需运行它们或创建二进制文件。

huangapple go评论73阅读模式
英文:

Check tests compile without running them or creating a binary

问题

使用Go语言,我如何检查我的测试代码是否能够编译通过,而不生成任何二进制文件或执行测试?

这相当于go build ./...的测试版本,它可以忽略测试。

英文:

How with Go can I check that my tests compile without creating any binaries or executing the tests?

The test equivalent of go build ./..., which does this but ignores tests.

答案1

得分: 5

我使用任何不匹配的正则表达式作为运行标志,例如

go test -run NONE ./...
英文:

I use any non-matching regex for the run flag, like

go test -run NONE ./...

huangapple
  • 本文由 发表于 2015年8月23日 10:35:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/32162657.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定