-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/pkgsite: examples should run using the same version as the docs #50769
Comments
dup of #46689 ? |
@seankhliao Thanks for bringing that issue up - I wasn't aware of it. Although it does seem to be the same underlying problem, I'd say that issue wasn't framed correctly. Pre-release version or not, I believe that any example should run in the context of the version that is being documented. Using the latest version is not appropriate for any version that isn't the latest version, and that applies doubly so when the major version is zero and backward compatibility is not guaranteed. |
The playground supports specifying module versions with an inline mod file. See this example. Maybe for documentation pages we could place an inline mod file into each example. |
@jamalc Yes, that's exactly the kind of thing I was thinking of. |
Change https://go.dev/cl/444455 mentions this issue: |
…amples For all non-standard library packages, their examples in the docs are ran using the version as the docs by adding an inline mod file that specifies the module version of the package. For golang/go#50769 Change-Id: I539260147aedade112a2e812c5ea4d19235774c2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/444455 Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Run-TryBot: Dylan Le <dungtuanle@google.com>
The problem is resolved in https://go.dev/cl/444455. Thanks @jamalc for the help! |
When running an example within a package, I just noticed that the example does not run using the version that's being shown in the doc page.
Here's a screenshot that demonstrates the issue. The example, which compiles fine, fails to run because it uses a feature of the API that's not in the "latest" tag (v0.0.9). ISTM that the playground code within a particular version should be pinned to exactly that version (v0.0.10-0.20220124095424-0da3c8f5f56c in this case). I saw this issue here: https://pkg.go.dev/github.com/rogpeppe/retry@v0.0.10-0.20220124095424-0da3c8f5f56c.
The text was updated successfully, but these errors were encountered: