Skip to content
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

Open
rogpeppe opened this issue Jan 24, 2022 · 4 comments
Open

x/pkgsite: examples should run using the same version as the docs #50769

rogpeppe opened this issue Jan 24, 2022 · 4 comments
Labels
NeedsInvestigation pkgsite

Comments

@rogpeppe
Copy link
Contributor

@rogpeppe rogpeppe commented Jan 24, 2022

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.

image

@gopherbot gopherbot added this to the pkgsite/unplanned milestone Jan 24, 2022
@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Jan 24, 2022

dup of #46689 ?

@rogpeppe
Copy link
Contributor Author

@rogpeppe rogpeppe commented Jan 24, 2022

@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.

@jamalc jamalc added the NeedsInvestigation label Jan 31, 2022
@jamalc
Copy link

@jamalc jamalc commented Jan 31, 2022

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.

@rogpeppe
Copy link
Contributor Author

@rogpeppe rogpeppe commented Feb 1, 2022

@jamalc Yes, that's exactly the kind of thing I was thinking of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation pkgsite
Projects
None yet
Development

No branches or pull requests

4 participants