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
Is your feature request related to a problem? Please describe.
A simplified code is as follows:
funcTestA(t*testing.T) {
tests:=make([]int, 100)
fori:=rangetests {
println("i: ", i)
ifi==0 {
t.Fatal("i == 0") // MATCH /unreachable code after this statement/println("unreachable")
continue
}
ifi==1 {
t.Fatalf("i:%d", i) // MATCH /unreachable code after this statement/println("unreachable")
continue
}
ifi==2 {
t.FailNow() // MATCH /unreachable code after this statement/println("unreachable")
continue
}
/* Skip is used to temporarily skip tests. The code following it is intentionally unreachable. if i == 3 { t.Skip("i == 3") // MATCH /unreachable code after this statement/ println("unreachable") continue } if i == 4 { t.Skipf("i:%d", i) // MATCH /unreachable code after this statement/ println("unreachable") continue } if i == 5 { t.SkipNow() // MATCH /unreachable code after this statement/ println("unreachable") continue } */
}
}
Abirdcfly
changed the title
add testing.FailNow testing.SkipNow and related function to unreachable check
add testing.FailNow and related function to unreachable check
Jul 20, 2022
Is your feature request related to a problem? Please describe.
A simplified code is as follows:
The actual code can be seen in k8s https://github.com/kubernetes/kubernetes/pull/111228/files#diff-b5b428649cab55e247eddbd00bc278c628c40ed524814ffe9dede44af19ee3b5R1899 and etcd etcd-io/etcd#14235
Describe the solution you'd like
I wish there was a way to detect them
Describe alternatives you've considered
Goland can detect them, but has bug in some situation, see https://youtrack.jetbrains.com/issue/GO-13383
go vet cant detect this. Some discussions are here golang/go#53968
Additional context
None
The text was updated successfully, but these errors were encountered: