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:
This is related to #31716.
/cc @jba @neild
@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.
/cc @mpvl @jba any thoughts? Is this something one of you can work on or delegate?
https://github.com/golang/go/wiki/ErrorValueFAQ answers some of the questions.
I'll take this.
@nsajko Thanks for reminding me of that. @cespare, to what extent does that FAQ do what you want?
@andybons is it kosher to reference a wiki package from the doc of a standard library package? Would that make sense here?
Thanks @jba!
@nsajko Thanks for reminding me of that. @cespare, to what extent does that FAQ do what you want?
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 is it kosher to reference a wiki package from the doc of a standard library package? Would that make sense here?
@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 package
"wiki page"
@cespare, I will aim for something like context.
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: errors: improve doc
https://go-review.googlesource.com/c/go/+/188737.
I deliberately did not address the Is and As _methods_. I think that's another CL.
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 undefined: errors.As?
@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: errors: document Is and As methods
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?
@neild @mpvl @rsc Can one or all of you please take a look?
Most helpful comment
@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