diff --git a/src/cmd/go/test.go b/src/cmd/go/test.go index 57b764586a..50de8f292c 100644 --- a/src/cmd/go/test.go +++ b/src/cmd/go/test.go @@ -937,7 +937,7 @@ func coveragePercentage(out []byte) string { // The string looks like // test coverage for encoding/binary: 79.9% of statements // Extract the piece from the percentage to the end of the line. - re := regexp.MustCompile(`coverage for [^ ]+: (.*)\n`) + re := regexp.MustCompile(`coverage: (.*)\n`) matches := re.FindSubmatch(out) if matches == nil { // Probably running "go test -cover" not "go test -cover fmt". diff --git a/src/pkg/testing/cover.go b/src/pkg/testing/cover.go index 4f66a0b792..22a5299b8f 100644 --- a/src/pkg/testing/cover.go +++ b/src/pkg/testing/cover.go @@ -89,5 +89,5 @@ func coverReport() { if total == 0 { total = 1 } - fmt.Printf("coverage for %s: %.1f%% of statements%s\n", testedPackage, 100*float64(active)/float64(total), coveredPackage) + fmt.Printf("coverage: %.1f%% of statements%s\n", 100*float64(active)/float64(total), coveredPackage) }