Skip to content

Files

Latest commit

 

History

History
31 lines (21 loc) · 665 Bytes

unreachable.md

File metadata and controls

31 lines (21 loc) · 665 Bytes

Pattern: Unreachable code

Issue: -

Description

Unreachable code can never be executed because there exists no control flow path to the code from the rest of the program. It is generally considered undesirable for a number of reasons, including increased code size and increased time and effort for maintenance. Consider deleting unused code to resolve this issue.

Example of incorrect code:

func _() int {
	print(1)
	return 2
	println() // unreachable code
}

Example of correct code:

func _() int {
	print(1)
	return 2
}

Further Reading