Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: should include packages without tests in cover profile file #27261

13rac1 opened this issue Aug 27, 2018 · 1 comment


None yet
1 participant
Copy link

commented Aug 27, 2018

What version of Go are you using (go version)?

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?


What did you do?

Created a new project with two sub-packages:

├── notests
│   └── notests.go
└── tests
    ├── tests.go
    └── tests_test.go

2 directories, 3 files


package notests

import "fmt"

func untested() {


package tests

import "fmt"

func tested() {


package tests

import "testing"

func TestTested(t *testing.T) {

Ran go test ./... -v -cover -coverprofile cover.out

What did you expect to see?

$ cat cover.out
mode: set
empty-cover-profile/notests/notests.go:7.17,9.2 1 0
empty-cover-profile/tests/tests.go:7.15,9.2 1 1

Coverage details for both files.

#18909 requested this functionality, but it wasn't implemented in

What did you see instead?

$ cat cover.out
mode: set
empty-cover-profile/tests/tests.go:7.15,9.2 1 1

Coverage details only for the file with a test in the same directory.


echo "package notests" > notests/notests_test.go

Creating an empty test file creates coverage for both files.


This comment has been minimized.

Copy link

commented Aug 27, 2018

Dupe of #24570

@13rac1 13rac1 closed this Aug 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.