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

cmd/vet: go vet warns about unreachable panics #28838

Closed
jech opened this issue Nov 16, 2018 · 1 comment
Closed

cmd/vet: go vet warns about unreachable panics #28838

jech opened this issue Nov 16, 2018 · 1 comment

Comments

@jech
Copy link

jech commented Nov 16, 2018

go version go1.11.2 linux/amd64

I like to put panics in places that I know are unreachable. Go vet complains.

For example, the following code yields an unreachable code warning:

package main

func main() {
	return
	panic("unreachable")
}

@ianlancetaylor ianlancetaylor changed the title Go vet warns about unreachable panics cmd/vet: go vet warns about unreachable panics Nov 16, 2018
@ianlancetaylor
Copy link
Contributor

I think it's entirely reasonable that a warning about unreachable code warns about unreachable code, even if that code is a call to panic. You can disable the warning with -unreachable=false.

@golang golang locked and limited conversation to collaborators Nov 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants