-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/cover: Limit on number of consecutive if..then..else statements in "go test -cover" #10950
Comments
I can't reproduce this at HEAD (714291f), even if I extend it up to 80 conditionals. Can you tell us what |
FYI, package invalid
func Exhausted(i int) {
cov.Count[0] = 1
if i == 1 {
cov.Count[1] = 1
} else {
cov.Count[2] = 1
if i == 1 {
cov.Count[3] = 1
} else {
cov.Count[4] = 1
if i == 2 {
cov.Count[5] = 1
} else {
cov.Count[6] = 1
if i == 3 {
cov.Count[7] = 1
} else {
cov.Count[8] = 1
if i == 4 {
cov.Count[9] = 1
} else {
cov.Count[10] = 1
if i == 5 {
cov.Count[11] = 1
} else {
cov.Count[12] = 1
if i == 6 {
cov.Count[13] = 1
} else {
cov.Count[14] = 1
if i == 7 {
cov.Count[15] = 1
} else {
cov.Count[16] = 1
if i == 8 {
cov.Count[17] = 1
} else {
cov.Count[18] = 1
... |
It can be reproduced by Go 1.4, where we're still using It has been fixed by the Go rewrite. I've tested a much more |
When I execute "go test -coverprofile=c.out" with the version "go version go1.4 darwin/amd64" I can reproduced the error. I solved reducing the number of IFs like JoshVarga said. |
When compiling the following code "go build" and "go test" work as expected, however when runing "go test -cover" it gets:
invalid.go
invalid_test.go
The source does require 40 or more if-then-else statements on my machine to replicate this issue.
The error text is also confusing mainly because the file only has 46 lines yet it says the issue is on line 166 and it doesn't tell me what is actually wrong.
The text was updated successfully, but these errors were encountered: