Skip to content

redundant-switch-break

Remove an unlabeled break at the end of a switch case.

Updated View as Markdown

Default severity: warning

Go switch cases do not fall through unless they explicitly use fallthrough. An unlabeled break as the final statement of a case is therefore redundant.

Bad

switch value {
case 1:
	use(value)
	break
}

Good

switch value {
case 1:
	use(value)
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close