-
Notifications
You must be signed in to change notification settings - Fork 18k
errors: As should allow target to be a nil pointer to a concrete type #31541
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
I don't see a problem with this. |
So what should the -- An aside: the
Should that be "assignable through"? It only matches if the given error (or an unwrapped error) can be assigned to the "element" value of target. This seems like it needs some clarification. |
Change https://golang.org/cl/179978 mentions this issue: |
That's true.
In the same CL linked above, I reworded that part of the doc. PTAL. |
I think this API change is a mistake, for the reasons adg gives above. |
Abandoned the CL. |
What did you do?
What did you expect to see?
errors.As
being useful for type-checks even if I don't want to allocate space to store the result.For this specific example:
What did you see instead?
This is the documented behavior of
errors.As
, but it seems strictly less useful than allowing anil
pointer of a concrete type.The text was updated successfully, but these errors were encountered: