I have a project like this:
app/
api/
foo.go
test_foo.go
src/
db/
bar.go
In foo.go
, a call is made to a function in bar.go
. However, when running the coverage report, it shows that 0 lines of bar.go are covered.
Is there a way to get coverage to include function call to other packages?
In my case, I do not want to make separate tests for db
and for api
, since all calls through db
will always go through api
, and it would be redundant to write two tests.
I'm running the coverage like this:
go clean -testcache
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out