Embedding playground snippets in gist-like way

840 views
Skip to first unread message

Carlos

unread,
May 30, 2015, 5:58:44 PM5/30/15
to golan...@googlegroups.com
As far as I can tell, there isn't any way to embed playground snippets like Github's gist.

Is it OK that I implement this change? Or is there any reason for not doing it?

minux

unread,
May 30, 2015, 8:19:43 PM5/30/15
to Carlos, golang-nuts
On Sat, May 30, 2015 at 5:58 PM, Carlos <ulderi...@gmail.com> wrote:
As far as I can tell, there isn't any way to embed playground snippets like Github's gist.

Do you want to only embed the code or also have the Run button?
To embed the code, you can fetch the URL with ".go" appended to it.

e.g. embed the code for http://play.golang.org/p/duRF5gXJEP, just

To embed a real playground widget along with the play function,
please see how the present tool does it.
With the help of:
and

Note that to use the http transport, you web server must implement
the /compile handler, and if you are using Go, just import
But please remember to request for the playground service on the
golang-dev mailing list first, and use a unique user agent for all your
requests.

C Cirello

unread,
May 31, 2015, 8:00:44 AM5/31/15
to minux, golang-nuts
The idea is having something similar to present/godoc, but that could
be copy&pastable straight from play.golang.org - and not start a new
service, thus the UA notification in golang-dev is not necessary. So
essentially, I am advocating updating
https://go.googlesource.com/playground

Like gist you have the option to copy an embeddable HTML code, the
same would be available for playground.
- CC

minux

unread,
Jun 1, 2015, 1:42:46 AM6/1/15
to C Cirello, Andrew Gerrand, golang-nuts
On Sun, May 31, 2015 at 8:00 AM, C Cirello <ulderi...@gmail.com> wrote:
The idea is having something similar to present/godoc, but that could
be copy&pastable straight from play.golang.org - and not start a new
service, thus the UA notification in golang-dev is not necessary. So
essentially, I am advocating updating
https://go.googlesource.com/playground

So you want to be able to embed play.golang.org in an iframe?
Sounds good to me. I copied Andrew on this thread, if he also
agrees, please feel free to send the CL. Thanks.

C Cirello

unread,
Jun 1, 2015, 3:49:04 AM6/1/15
to minux, Andrew Gerrand, golan...@googlegroups.com

Yes, You expressed in better words what I wanted.

Andrew Gerrand

unread,
Jun 1, 2015, 2:00:21 PM6/1/15
to minux, C Cirello, golang-nuts
Sounds good to me. Send a CL.

C Cirello

unread,
Jun 1, 2015, 2:00:55 PM6/1/15
to Andrew Gerrand, minux, golan...@googlegroups.com

Ok. Working on it then.

Ggicci T'ang

unread,
May 11, 2022, 1:48:19 PM5/11/22
to golang-nuts
I've implemented a simple js sdk goplay to connect to a reverse proxy to the official go playground service at go.dev/play.
Now it seems works smoothly. If you are interested in this, I'd like to share it with you: ggicci.me/goplay.
Reply all
Reply to author
Forward
0 new messages