Ameron Stack Overflow • Recommends
…codes. Hence, the need for sub-process testing.
I tried sub-process testing technique but modified code so that it include flag for coverage:
cmd := exec.Command(os.Args0, "-test.run=TestMain -test.coverprofile=/vagrant/ucover/coverage2.out")
Here is original code: https://talks.golang.org/2014/testing.slide#23
Explanation of above slide: link to this video
But it doesn't generate cover profile. I haven't been able to figure out why not. It does generate cover profile for main process executing……