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
errors: example code for errors.As has extraneous code #38369
Comments
Change https://golang.org/cl/227937 mentions this issue: |
The package doc for
(Emphasis mine.) The So I think this is a bug in the |
Change https://golang.org/cl/228038 mentions this issue: |
@dmitshur, is this a godoc bug? |
Is this a consequence of #38376 ? |
@FiloSottile Yes. @jba's analysis is correct. It's a regression in |
Add ExampleIs to illustrate how errors.Is works. Updates #31716. Updates #38369. Change-Id: I1b9a6667614635aa3a5ed8b2c108d8eb6f35748b Reviewed-on: https://go-review.googlesource.com/c/go/+/228038 Reviewed-by: Damien Neil <dneil@google.com>
The example was failing to direct users on what to do with the nonce, which should be almost universally prepended to the ciphertext. Also, leaving key out of the function was pulling the entire file into the example. Updates golang/go#38369 Change-Id: I3a13342fff02e1a5d6f9c4ef2a8bddf0b1097707 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/227937 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
The example code for
errors.As
(viewed at https://pkg.go.dev/errors?tab=doc#As) is the entire contents of thewrap_test.go
file. It should be justfunc ExampleAs() { ... }
I presume.In talking this over with @FiloSottile, this may be a more systemic issue which can be improved in
godoc
. For example, we have the same issue with the chacha20poly1305.NewX example code. However, perhaps we should fix the example for the errors package for now either way.While we're in there, perhaps we should check if there are any improvements to the documentation for errors as tracked in #31716.
/cc @jba @mpvl
The text was updated successfully, but these errors were encountered: