I have a small go command line utility that I am building in the usual way:
go build
I use the flag
package to add command line flags. And all was going swimmingly until I started getting a lot of test flags showing up. Now when I print the usage using flag.Usage
I see lots of extra flags:
-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)
There are a lot more than this.
I am using the main flag set and adding flags with flag.IntVar
and the like.
I can't figure out what I did or how this could have been enabled. None of my other programs include these test flags in the default usage message. I appreciate any pointers.
The testing
package's init()
adds command line arguments to your app using the flags package.
You are likely referencing testing
from some bit of non-testing code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With