Home:ALL Converter>golang benchmark set testing flags in code

golang benchmark set testing flags in code

Ask Time:2023-01-02T19:15:27         Author:sriep

Json Formatter

I have a preexisting custom golang benchmark program; It runs benchmraks using testing.Benchmark on a collection of functions.

This program uses cobra for input parameters.

How do I use testing flags in the benchmarks?

I cannot see a way to set them in the code explicitly, and I can't get command line options to work.

Author:sriep,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74981736/golang-benchmark-set-testing-flags-in-code
yy