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

Comments

Projects
None yet
2 participants
@jech
Copy link

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

This comment has been minimized.

Copy link
Contributor

commented Nov 16, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.