-
Notifications
You must be signed in to change notification settings - Fork 18k
errors: better document Go 1.13 Is/As/Unwrap features #33364
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
This is related to #31716. |
@andybons you added a "doc:" prefix, but to be clear, what I'm talking about in this issue is package documentation for the errors package (i.e., changes to .go files), not further documents in the doc/ directory. Other documentation issues (#33185, #32820, and #32303 are recent ones) don't use a doc: prefix. |
@cespare got it. Removed. |
https://github.com/golang/go/wiki/ErrorValueFAQ answers some of the questions. |
I'll take this. |
Thanks @jba!
The wiki page is useful, but it is no substitute for package documentation. (And after reading the package documentation, I wouldn't even know that "error values" is the name of the concept.)
@andybons will correct me if I'm wrong, but I'm quite certain that the policy is that we do not link user-editable wiki pages from package documentation. I think I useful point of comparison is the context package documentation: that is another package with a small API surface where simply listing the functions doesn't convey the scope or purpose; in order for context to provide full value, the whole ecosystem needs to follow a certain set of conventions about how context is used. The top-level package documentation explains these conventions and uses normative language to push users toward common practices. |
"wiki page" |
@cespare, I will aim for something like I also found this CL that has been languishing: https://go-review.googlesource.com/c/go/+/184237. I know that's not enough, but if you think it helps and you have +2 power, feel free :) |
Don't link to wiki pages from user docs for the reasons @cespare noted above. Anyone in the world can change the info without review. |
Change https://golang.org/cl/188737 mentions this issue: |
https://go-review.googlesource.com/c/go/+/188737. I deliberately did not address the Is and As methods. I think that's another CL. |
Explain wrapping and how to use Is and As in the package doc. Explain "chain" in Is and As. Updates #33364. Change-Id: Ic06362106dbd129e33dd47e63176ee5355492086 Reviewed-on: https://go-review.googlesource.com/c/go/+/188737 Reviewed-by: Rob Pike <r@golang.org>
I don't know if this is the best place to mention this, but is it expected that at this time that this example should fail with the error |
@jwenz723 the playground service do not have the latest 1.13 beta, that's why it shows the error. BTW, Go team should offer the playground service with all different versions of Go, including released betas. I am not sure this suggestion was submitted in another issue. @ianlancetaylor |
The playground discussion should be on a different issue. I don't know of an existing one. |
Change https://golang.org/cl/191338 mentions this issue: |
https://golang.org/cl/191338 attempts to address the Is and As methods. I think a complete effort would involve examples at a minimum, and given the difficulty in getting even https://golang.org/cl/184237 reviewed, that doesn't seem feasible for 1.13. |
I don't see any comments on https://golang.org/cl/184237 Is the issue that no one is responding at all? |
Add brief descriptions of why one might implement an Is or As method. Fixes golang#33364. Change-Id: I81a091bf564c654ddb9ef3997e780451a01efb7a Reviewed-on: https://go-review.googlesource.com/c/go/+/191338 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Andrew Bonventre <andybons@golang.org> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Add brief descriptions of why one might implement an Is or As method. Fixes golang#33364. Change-Id: I81a091bf564c654ddb9ef3997e780451a01efb7a Reviewed-on: https://go-review.googlesource.com/c/go/+/191338 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Andrew Bonventre <andybons@golang.org> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
See the current version of the Go 1.13 documentation for the errors package here: https://tip.golang.org/pkg/errors/
If I hadn't read the error values design and related discussion, I think I'd have a hard time understanding the new APIs. Some questions I might have include:
The text was updated successfully, but these errors were encountered: