play.golang.org API to share code?

570 views
Skip to first unread message

Rocky Bernstein

unread,
Apr 15, 2013, 1:23:40 PM4/15/13
to golan...@googlegroups.com
play.golang.org has button to share code. I'd like to add a similar button to https://code.google.com/p/go-play/. Is this possible? That is, is there a public API for adding code to play.golang.org

Related, I don't see mechanism for deleting the shared code once it is on the there. Is there one? If not, how long do the shared code last? 

Péter Szilágyi

unread,
Apr 15, 2013, 3:32:05 PM4/15/13
to Rocky Bernstein, golan...@googlegroups.com
Don't know about the API, but it would be nice if shared code actually lasted "forever", otherwise old references (emails) will quickly fill up with dangling links.


On Mon, Apr 15, 2013 at 7:23 PM, Rocky Bernstein <rocky.b...@gmail.com> wrote:
play.golang.org has button to share code. I'd like to add a similar button to https://code.google.com/p/go-play/. Is this possible? That is, is there a public API for adding code to play.golang.org

Related, I don't see mechanism for deleting the shared code once it is on the there. Is there one? If not, how long do the shared code last? 

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

minux

unread,
Apr 15, 2013, 4:51:39 PM4/15/13
to Rocky Bernstein, golan...@googlegroups.com, Andrew Gerrand
On Tue, Apr 16, 2013 at 1:23 AM, Rocky Bernstein
<rocky.b...@gmail.com> wrote:
> play.golang.org has button to share code. I'd like to add a similar button
> to https://code.google.com/p/go-play/. Is this possible? That is, is there a
> public API for adding code to play.golang.org?
there is one, you just need to do ajax call to http://play.golang.org/share, see
tip.golang.org/src/cmd/godoc/play.go and tip.golang.org/doc/play/playground.js
for details.
> Related, I don't see mechanism for deleting the shared code once it is on
> the there. Is there one? If not, how long do the shared code last?
I think only its admin can delete shared code.
adg@ must know the details (cc'd).

Ernest Micklei

unread,
Apr 16, 2013, 4:46:52 AM4/16/13
to golan...@googlegroups.com, Rocky Bernstein
I would be very disappointed if it turns out that shared playground code has an expiration time. I think it is a great community building feature.  Why not keep these snippets around forever?
It would be nice to see what usage statistics (counts, hits) it has (over time).

^ Ernest

mattn

unread,
Apr 16, 2013, 5:02:48 AM4/16/13
to golan...@googlegroups.com
Hi.


$ go build share.go
$ cat share.go | ./share

mattn

unread,
Apr 16, 2013, 5:13:14 AM4/16/13
to golan...@googlegroups.com
Ah, sorry. you are saying share button. Probably, play.golang.org/share allow only POST method. So we can do it without Access-Control-Allow-Origin.

mattn

unread,
Apr 16, 2013, 5:13:44 AM4/16/13
to golan...@googlegroups.com
Sorry again.
s/we can/we can't/

Andrew Gerrand

unread,
Apr 19, 2013, 10:25:00 AM4/19/13
to Péter Szilágyi, Rocky Bernstein, golan...@googlegroups.com

On 16 April 2013 05:32, Péter Szilágyi <pet...@gmail.com> wrote:
Don't know about the API, but it would be nice if shared code actually lasted "forever", otherwise old references (emails) will quickly fill up with dangling links.

play.golang.org snippets won't go away unless we have a reason to remove them. "forever" seems a reasonable expectation.

Andrew

rocky

unread,
May 4, 2013, 6:46:47 PM5/4/13
to golan...@googlegroups.com, Péter Szilágyi, Rocky Bernstein
While this is vague enough that it can't be the wrong thing to do, my gut says it's not ultimately the right thing either. 

I imagine already http://play.golang.org is already filled with hundreds (if not thousands) of "hello world" programs because people were trying out play.golang.org and happened to click on the "share" button to see how it works. 

Yes, even at thousands or millions of hello programs that's probably not a lot of disk space. But other than showing off how your filesystem can handle lots of (useless) files (probably in a single directory), this can't do anyone much good. Storing more stuff and garbage has to slow things down at least a little bit if not cause problems for systems administration.

Long term, I suspect what will probably be desired is something more aligned to github gists where the shared code is associated with a person and that person then can decide to remove the code. 


Andrew

Aaron France

unread,
May 4, 2013, 7:30:14 PM5/4/13
to rocky, golang-nuts, Péter Szilágyi
Hi,

Doesn't the playground re-use the same hash if the code is the same? If people accidentally click share on the default code snippet then it won't create a new stored snippet. Right?

Aaron


--

Rocky Bernstein

unread,
May 4, 2013, 7:42:25 PM5/4/13
to Aaron France, golang-nuts, Péter Szilágyi
I did some small experiments and, yes, it does like the filename is some sort of hash of the data.

David Anderson

unread,
May 4, 2013, 8:38:15 PM5/4/13
to rocky, golang-nuts, Péter Szilágyi
On Sat, May 4, 2013 at 3:46 PM, rocky <rocky.b...@gmail.com> wrote:


On Friday, April 19, 2013 10:25:00 AM UTC-4, Andrew Gerrand wrote:

On 16 April 2013 05:32, Péter Szilágyi <pet...@gmail.com> wrote:
Don't know about the API, but it would be nice if shared code actually lasted "forever", otherwise old references (emails) will quickly fill up with dangling links.

play.golang.org snippets won't go away unless we have a reason to remove them. "forever" seems a reasonable expectation.


While this is vague enough that it can't be the wrong thing to do, my gut says it's not ultimately the right thing either. 

I imagine already http://play.golang.org is already filled with hundreds (if not thousands) of "hello world" programs because people were trying out play.golang.org and happened to click on the "share" button to see how it works. 

Yes, even at thousands or millions of hello programs that's probably not a lot of disk space. But other than showing off how your filesystem can handle lots of (useless) files (probably in a single directory), this can't do anyone much good. Storing more stuff and garbage has to slow things down at least a little bit if not cause problems for systems administration.

It runs on App Engine. Even using gigabytes of storage would hardly make a dent as far as the backend store is concerned. And gigabytes of hello world is a lot of hello worlds.
 

Long term, I suspect what will probably be desired is something more aligned to github gists where the shared code is associated with a person and that person then can decide to remove the code.  


Andrew

--

Steven Johnson

unread,
May 4, 2013, 8:57:12 PM5/4/13
to David Anderson, rocky, golang-nuts, Péter Szilágyi
On Sat, May 4, 2013 at 5:38 PM, David Anderson <da...@natulte.net> wrote:
 And gigabytes of hello world is a lot of hello worlds.

Hmm... is the plural "hello worlds" or "hellos world"?
 

 

Steven Blenkinsop

unread,
May 4, 2013, 11:47:18 PM5/4/13
to Steven Johnson, David Anderson, rocky, golang-nuts, Péter Szilágyi
 "World" here isn't a modifier on "hello", so no. I'd guess it would pluralize like "Hail Mary".
Reply all
Reply to author
Forward
0 new messages