err != nil
when err == nil
with custom error
type
#35292
Labels
err != nil
when err == nil
with custom error
type
#35292
What version of Go are you using (
go version
)?Though I think this works on all recent versions ... ?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/wYWX4cDk3rc
What did you expect to see?
I expected
err == nil
to returntrue
.What did you see instead?
I saw
err == nil: false
in the output. I suspect this has to do with what is mentioned in the laws of reflection: that instead oferr
having a purenil
value, it's pointing to the (value, type) tuple (nil
,*Err
). However, I don't understand why this would be desirable.Thank you for your time!
The text was updated successfully, but these errors were encountered: