Skip to content

cmd/cover: should support -coverprofile unifying tests from multiple packages #6909

@wadey

Description

@wadey
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. run `go test -coverprofile=coverage.out ./...`

What is the expected output?

coverage.out contains coverage all of the specified packages

What do you see instead?

`cannot use test profile flag with multiple packages`

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

OS X 10.9

Which version are you using?  (run 'go version')

go version go1.2 darwin/amd64

Please provide any additional information below.

If I manually construct a coverage.out file from multiple packages, it seems to work
fine:

1. go test -coverprofile a.part ./a
2. go test -coverprofile b.part ./b
3. echo "mode: set" >coverage.out
4. grep -h -v "mode: set" *.part >>coverage.out
5. go tool cover -html=coverage.out

Why can't `go test -coverprofile` do this automatically?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions