Code Coverage

I am trying to get code coverage for my Golang tests. I run the tests with "Run 'go test tests' with Coverage" from the Goland IDE. The tests execute fine, but the coverage for all code files and packages is reported as "No coverage in 'foo'". I only have a few tests but I know they cover some of the code listed as not covered (as everything is listed so...). "tests" is the directory under which my tests are.

Is there some specific structure for the project that the IDE expects, or is there some other configuration that I am missing? This is on OSX with Goland 2018.1.

Have not done much Go, and still learning, so very much a possibility that I don't quite know or follow the expected conventions of the platform, and the IDE expects something different.

1 comment

I moved the tests into the same package (directory), and now the coverage reporting works. So if this is required, how do I get total coverage of unit + integration tests if I put integration tests outside the package(s), and if they cover multiple packages?


Please sign in to leave a comment.