You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A workaround is that of making Error a struct [ n int64 }, and its Error method a pointer receiver. Weirdly enough, without the pointer receiver it doesn't work still!
The text was updated successfully, but these errors were encountered:
The root cause is probably different, related to how we pass around errors as values; but I'm leaving that as a // TODO for the undertaker
thehowl
changed the title
returning a "numeric error" through io.ReadAll makes the error become nil
returning a 0 "numeric error" through io.ReadAll makes the error become nil
Nov 16, 2023
thehowl
changed the title
returning a 0 "numeric error" through io.ReadAll makes the error become nil
0 "numeric errors" will be == to any error created with errors.NewNov 16, 2023
Briefly it's because the incorrect type. the vm erroneously treat Error(0) and errCmp with same type of int64, which is the underlying type of Error, thus the value evaluated as int64 are both 0. that is also why Error(1) works. I opened an issue to discuss this #1424 .
Discovered while fixing out bugs for #1290.
If the error is
Error(1)
, it works normally.A workaround is that of making Error a
struct [ n int64 }
, and itsError
method a pointer receiver. Weirdly enough, without the pointer receiver it doesn't work still!The text was updated successfully, but these errors were encountered: