Once control flow has been moved out of the current code block, any subsequent statements become effectively unreachable.
Some statements (return, break, continue, goto, switch) and throw
expressions move control flow out of the current code block. So any unlabeled statements that come after such a jump are unreachable, and either this
dead code should be removed, or the logic should be corrected.
func add(x, y int) int {
return x + y // Noncompliant
z := x + y // dead code
}
func add(x, y int) int {
return x + y // Compliant
}