Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST1015: don't flag default case that is involved in fallthrough #1188

Closed
dominikh opened this issue Feb 18, 2022 · 0 comments
Closed

ST1015: don't flag default case that is involved in fallthrough #1188

dominikh opened this issue Feb 18, 2022 · 0 comments

Comments

@dominikh
Copy link
Owner

Adapted from real code seen in the wild:

func fn(x int) {
	switch x {
	case 0:
		println("we can do zero")
	default:
		println("we can't do x, we'll pretend it's 1")
		fallthrough
	case 1:
		println("we can do one")
	}
}

Same issue exists when we fall into the default branch.

Updates #739

dominikh added a commit that referenced this issue May 16, 2022
dominikh added a commit that referenced this issue May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant