-
Notifications
You must be signed in to change notification settings - Fork 18k
errors: As crashes if nil error is passed #30970
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
Comments
Should Either way, we should state the behavior in the docstring. |
returned false if nil error is passed. Pushed the changes to Gerrit for code review. |
Logically, if there is no error, then it cannot be a particular error, so false makes sense. Practically, I might want to write something like
so false is useful. |
Change https://golang.org/cl/168598 mentions this issue: |
Returning false for a nil error seems reasonable to me. |
Change https://golang.org/cl/170960 mentions this issue: |
Fixes #30970 Change-Id: I333676b55a2364e329fffeafca8fc57d45a0b84b Reviewed-on: https://go-review.googlesource.com/c/go/+/168598 Reviewed-by: Marcel van Lohuizen <[email protected]> Run-TryBot: Marcel van Lohuizen <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
What version of Go are you using (
go version
)?What did you do?
What did you expect to see?
No output or an intentional error
What did you see instead?
Note that this does not happen with
errors.Is
. Something like this works fine:Possibly due to this https://github.com/golang/go/blob/master/src/errors/wrap.go#L55
/cc @mpvl @jba
The text was updated successfully, but these errors were encountered: