Dead Code (ARCH5188)
Ce contenu n’est pas encore disponible dans votre langue.
Key go.quality.dead-code · Severity info · Category quality
Unreachable code after a return never runs, misleads readers, and adds maintenance burden. Remove it.
Incorrect
Section titled “Incorrect”func score(n int) int { if n > 0 { return n * 2 } return 0 log.Println("computed") // unreachable}Correct
Section titled “Correct”func score(n int) int { if n > 0 { return n * 2 } return 0}Delete unreachable statements; if the code is genuinely needed, restructure the control flow.