dave / courtney

Courtney is a coverage tool for Go
MIT License
168 stars 27 forks source link

Add mode to ingest pre-prepared coverage files #6

Closed dave closed 7 years ago

dave commented 7 years ago

@haya14busa:

Why not accepting coverage report text files instead of wrapping go test and executing tests? I like the concept but I don't want to replace go command as much as possible.

dave commented 7 years ago

I didn't add this because it's not quite as straightforward as you might think:

1) Unfortunately go test can't accept /... to indicate recursive packages when combined with code coverage:

$ go test -coverprofile=coverage.out ./...
cannot use test profile flag with multiple packages

... so the courtney command has to manually scan the filesystem for sub packages and run one go test command for each package.

2) In order to get coverage logged cross-package, you need to add all the packages you're testing as a comma separated list to the coverpkg argument.

You can see the go test commands that we're running when you add the -v flag.

However, I can see that this might be of use in certain situations, so I'll look into adding it as an option.

dave commented 7 years ago

I've added a -l option that allows you to skip the test step and load pre-prepared coverage files. Let me know what you think: https://github.com/dave/courtney/commit/715958ae7a9ecbe0752033c3d2c76935c71a2f0e

haya14busa commented 7 years ago

the problem is related with https://github.com/golang/go/issues/6909 and I fixed it by creating https://github.com/haya14busa/goverage