Consider a file structure like this:
api --
|_ routes.go
|_ handler.go
impl--
|_ impl.go
|_ impl_test.go
The "impl" file contains internal implementation of REST APIs for which the handlers and routes are in "handler.go" and "route.go" files respectively.
As far as packaging goes, everything under "api" folder is in the "api" package. The code in "impl.go" is in "impl" package and the code in "impl_test" package is in "impl_test" package.
api -------
|_ routes
|_ handler functions
impl-------
|_ impl functions
impl_test--
|_ test functions
The test function starts a HTTP server listening to a local open port using the routes and handlers in the "api" package and then call the APIs.
However, the coverage report shows 0% coverage for the code in the "api" package and non-zero% for "impl".
Can someone please explain why the coverage is measured for one package and not the other? And whether there is way to fix this?