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 missing playground links #36865

Open
myitcv opened this issue Jan 29, 2020 · 15 comments
Open

x/pkgsite: examples missing playground links #36865

myitcv opened this issue Jan 29, 2020 · 15 comments

Comments

@myitcv
Copy link
Member

@myitcv myitcv commented Jan 29, 2020

What is the URL of the page with the issue?

https://pkg.go.dev/regexp?tab=doc#example-MatchString

What is your user agent?

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.66 Safari/537.36

Screenshot

Screen Shot 2020-01-29 at 13 09 25

What did you do?

Visited the link above to view the example.

What did you expect to see?

Expected to see a link that takes me to the example in the Go Playground, like godoc.org

Screen Shot 2020-01-29 at 13 09 44

What did you see instead?

No link.

@julieqiu
Copy link
Contributor

@julieqiu julieqiu commented Jan 29, 2020

/cc @dmitshur

@gopherbot gopherbot added this to the Unreleased milestone Feb 6, 2020
@nu8
Copy link

@nu8 nu8 commented Mar 16, 2020

Yes thanks, I came here looking for this. If you visit the current site:

https://golang.org/pkg/io#Copy

You get complete example, with package main and everything. The example itself
is even editable without leaving the page, which is nice. You can run the
exmaple from the same page, or hit "Share" and it takes you to:

https://play.golang.org

Now if you visit the same page with the new site:

https://pkg.go.dev/io#Copy

You dont get a complete example, everything is stripped except for pretty much
the function call itself. The example is not editable. The example is not
runnable. No "Share" button is available to test with the playground. Overall
I would say its a worse experience, and I wont be updating my links.

I get that some might want to clean things up and remove cruft, but at a minimum
the playground links should be put back in. For myself, full, complete examples
are a critical part of the learning process. Please put them back in.

@Sajmani Sajmani self-assigned this Apr 1, 2020
gopherbot pushed a commit to golang/pkgsite that referenced this issue Jun 15, 2020
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.

Fixes golang/go#36865

Change-Id: I541774af5f29e0bdbb9bd812496cc6e4fd39fcb6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715584
Reviewed-by: Julie Qiu <julieqiu@google.com>
@julieqiu julieqiu reopened this Jun 15, 2020
@julieqiu julieqiu assigned AceroM and unassigned Sajmani Jun 15, 2020
@julieqiu julieqiu changed the title go.dev: examples missing playground links x/pkgsite examples missing playground links Jun 15, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 8, 2020

Change https://golang.org/cl/241259 mentions this issue: internal/fetch: remove fetchplayurl implementation

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 8, 2020

Change https://golang.org/cl/241164 mentions this issue: internal/frontend: add frontend server endpoint for proxying play.golang.org/share

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 9, 2020
…ang.org/share

This change adds a /play handler that mirrors requests
to play.golang.org/share which is used in implementing playground
integration in the frontend. This change also adds a test that
includes a mock server using net/httptest to check for proper
status codes.

Updates golang/go#36865

Change-Id: Ia3e902808534189ada747b270fed908e766c224b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241164
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 10, 2020

Change https://golang.org/cl/240685 mentions this issue: internal/fetch: modify render function to use doc.example and removed fetchplayurl

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 16, 2020
This commit modifies the codeHTML function to use *doc.Example
instead of a *doc.Example.Code so that we can have access to
*doc.Example.Play whenever the example is executable. This is important so that the imports are visible in the
example documentation. If the example doesn't include a executable editor,
it will default to rendering *doc.Example.Code. Also, this commit modifies the HTML template
to include a play button for the playground integration, which will be
displayed once all of the play button functionality is incorporated.
This commit also adds an experiment flag to enable the feature by
passing in context to the render function

For golang/go#36865

Change-Id: If2ef0d128fdd791617aad5dd8eb8a08c90e9ae72
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240685
Reviewed-by: Jonathan Amsterdam <jba@google.com>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 16, 2020

Change https://golang.org/cl/243037 mentions this issue: internal: fix experiment variable for executable examples

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 16, 2020
The experiment variable for executable examples was describing the
description of the variable rather than the name constant. This CL
changes it to the name constant.

For golang/go#36865

Change-Id: I84c3fcf8147c2c3964c262037ff2340f2ca0f39a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243037
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 17, 2020

Change https://golang.org/cl/243222 mentions this issue: internal/fetch: modify the documentation HTML/CSS to include playground executable examples

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 20, 2020

Change https://golang.org/cl/243638 mentions this issue: content/static: add CSS styling to the new embedded playground

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 20, 2020

Change https://golang.org/cl/243699 mentions this issue: content/static: add JS functionality to the new embedded playground

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 22, 2020
…r executable examples

This CL adds the HTML changes for the new play button, and error message for the playground integration. Corresponding experiment/feature flag is included.

This change also adds example_test testdata for tests that verify executable and non executable examples.

For golang/go#36865

Change-Id: I3b0339f61c2e46881681cc271252499142785000
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243222
Reviewed-by: Julie Qiu <julie@golang.org>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 22, 2020

Change https://golang.org/cl/244397 mentions this issue: internal/frontend: add integration test for playground example

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 24, 2020
This CL adds the CSS styling for the new playground examples. It is
currently under a feature flag, so the CL won't make any visible changes to the
website yet.

Without error: https://i.imgur.com/OK4V0sU.png
With error: https://i.imgur.com/sfqhZub.png

For golang/go#36865

Change-Id: I8d0e2aeeb4076bb863d36887bfe8cb0d791a1f25
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243638
Reviewed-by: Andrew Bonventre <andybons@golang.org>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 24, 2020

Change https://golang.org/cl/244763 mentions this issue: internal/fetch: revert HideButtons field experiment flag

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 25, 2020
This CL reverts the change for a "HideButtons" field in a package
example struct. Instead of using a feature flag that we turn off and on
for displaying the new Playground buttons, we will just replace the
`display: none;` property back to `display: flex` in a future commit.

For golang/go#36865

Change-Id: Iee29c431c22dc263bda8a812dfc148fd62d77f84
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/244763
Reviewed-by: Miguel Acero <acero@google.com>
gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 27, 2020
fetchPlayUrl creates a request to golang.org/share during the fetch process which we do not want since it would make too many requests. We no longer need this code since we are generating the playUrl in the client side through a button in the frontend. The current implementation has tests for modules with examples and replaces the playlinks.

This commit also updates the tests to reflect the current playground implementation.

For golang/go#36865

Change-Id: Ie590538db2dcdb94d5aa2cdac9c72c3522b7a565
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241259
Reviewed-by: Julie Qiu <julie@golang.org>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 29, 2020

Change https://golang.org/cl/245378 mentions this issue: internal/frontend: add integration test for playground example

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 29, 2020
This change adds a boolean "replay" flag in the existing playground test for the /share endpoint. When enabled, the test will make a request to play.golang.org instead of a mock httptest server.

For golang/go#36865

Change-Id: I26bb79d21500edbc128ce46e19bed493585a3e31
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245378
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 30, 2020
…yground

This CL implements a "play button" for each example in a given package
that redirects to play.golang.org.

This code is based on https://golang.org/lib/godoc/playground.js, it was
modified to remove the dependence on jquery and bootstrap, as well as
removing DOM creation to prevent jittering of the website.

Example behavior: https://i.imgur.com/NcGO3kx.gif

For golang/go#36865

Change-Id: Ic17ebd038561ef4dabbd139f6fa2e378968b01a1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243699
Reviewed-by: Andrew Bonventre <andybons@golang.org>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 30, 2020

Change https://golang.org/cl/245898 mentions this issue: internal/frontend: add metrics for playground share requests

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 31, 2020

Change https://golang.org/cl/246218 mentions this issue: content/static,internal: fix css padding for playground examples

@dmitshur dmitshur changed the title x/pkgsite examples missing playground links x/pkgsite: examples missing playground links Jul 31, 2020
gopherbot pushed a commit to golang/pkgsite that referenced this issue Aug 3, 2020
A metric is added for everytime a request is sent to play.golang.org.
The request status code will be used and is useful to have better
visibility on how many users click the new playground "play" button.

For golang/go#36865

Change-Id: I243efe5b3d8724fa6bdd60d332e2932925ffe094
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245898
Reviewed-by: Jonathan Amsterdam <jba@google.com>
@gopherbot
Copy link

@gopherbot gopherbot commented Aug 3, 2020

Change https://golang.org/cl/246498 mentions this issue: content/static: fix css padding for playground examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.