How can I compile tests to Binary and run Single Test

Hi,I am work on a toy fuzzer and want to compile the tests to a binary and run a single test each time.
I am at go1.17 and I already know that one can use

go test -c /path/to/src -o output_name

to get a binary, but when i run this

.\pkg.test.exe -test.run TestDemo

or any other -test options (eg -test.list), it will fail and output this:

flag provided but not defined: -test
Usage of pkg.test:
  -test.bench regexp
        run only benchmarks matching regexp
  -test.benchmem
...

Anyone can help? I would appreciate.

Solved, it is the problem of my env.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.