我有一个小的go命令行实用程序,我正在以通常的方式构建:
go build
Run Code Online (Sandbox Code Playgroud)
我使用该flag包添加命令行标志.一切都在游泳,直到我开始出现很多测试标志.现在,当我使用打印用法时,flag.Usage我会看到许多额外的标志:
-test.bench string
regular expression to select benchmarks to run
-test.benchmem
print memory allocations for benchmarks
-test.benchtime duration
approximate run time for each benchmark (default 1s)
-test.blockprofile string
write a goroutine blocking profile to the named file after execution
-test.blockprofilerate int
if >= 0, calls runtime.SetBlockProfileRate() (default 1)
Run Code Online (Sandbox Code Playgroud)
除此之外还有很多.
我正在使用主标志集和添加标志flag.IntVar等.
我无法弄清楚我做了什么或如何启用它.我的其他程序都没有在默认用法消息中包含这些测试标志.我很欣赏任何指针.