You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cd go/src/regexp
go test -run=TestMatch -coverprofile=x.prof
go tool cover -coverhtml=x.prof
Navigate to backtrack.go and scroll down.
In the tryBacktrack function, the switch inst.Op line is itself green but the entire switch body is gray, meaning untracked. It seems as if the coverage tool did not find and instrument the body at all. This may be a systemic problem so we should try to understand it for Go 1.13, and fix it if the fix is straightforward and low risk.
func testSwitch() {
for i := 0; i < 5; func() { i++; check(LINE, 5) }() {
goto label2
label1:
goto label1
label2:
switch i {
case 0:
check(LINE, 1)
case 1:
check(LINE, 1)
case 2:
check(LINE, 1)
default:
check(LINE, 2)
}
}
}
Adding this peculiar set of lines before the switch—a goto, a label, another goto, and another label—apparently causes ast.Walk to not even visit the switch's block. Will investigate further.
edit: I originally had an unnecessary if in there, now removed.
cd go/src/regexp
go test -run=TestMatch -coverprofile=x.prof
go tool cover -coverhtml=x.prof
Navigate to backtrack.go and scroll down.
In the tryBacktrack function, the switch inst.Op line is itself green but the entire switch body is gray, meaning untracked. It seems as if the coverage tool did not find and instrument the body at all. This may be a systemic problem so we should try to understand it for Go 1.13, and fix it if the fix is straightforward and low risk.
/cc @robpike in case you are interested
The text was updated successfully, but these errors were encountered: