go-playground

Discrepancies between Go Playground and Go on my machine?

佐手、 提交于 2019-12-19 10:11:50
问题 To settle some misunderstandings I have about goroutines, I went to the Go playground and ran this code: package main import ( "fmt" ) func other(done chan bool) { done <- true go func() { for { fmt.Println("Here") } }() } func main() { fmt.Println("Hello, playground") done := make(chan bool) go other(done) <-done fmt.Println("Finished.") } As I expected, Go playground came back with an error: Process took too long . This seems to imply that the goroutine created within other runs forever.

Which packages may be imported in the go playground?

て烟熏妆下的殇ゞ 提交于 2019-12-18 04:55:23
问题 I had trouble finding a list of what packages may be imported in the go playground at http://play.golang.org/. I was trying to use the (apparently experimental) package for ebnf. However even a short program won't import from golang.org (breaks on the import on line 4): package main import "fmt" import "golang.org/x/exp/ebnf" const g = ` Production = name "=" [ Expression ] "." . Expression = Alternative { "|" Alternative } . Alternative = Term { Term } . Term = name | token [ "…" token ] |

Discrepancies between Go Playground and Go on my machine?

我与影子孤独终老i 提交于 2019-12-01 10:12:23
To settle some misunderstandings I have about goroutines, I went to the Go playground and ran this code : package main import ( "fmt" ) func other(done chan bool) { done <- true go func() { for { fmt.Println("Here") } }() } func main() { fmt.Println("Hello, playground") done := make(chan bool) go other(done) <-done fmt.Println("Finished.") } As I expected, Go playground came back with an error: Process took too long . This seems to imply that the goroutine created within other runs forever. But when I run the same code on my own machine, I get this output almost instantaneously: Hello,

Can I import 3rd party package into golang playground

泄露秘密 提交于 2019-11-30 13:41:32
问题 I googled but got no answer. Is it possible? If yes, how to do it? The Go Playground link: https://play.golang.org/ 回答1: Since May 14th, 2019, it is now possible (from Brad Fitzpatrick)! The #golang playground now supports third-party imports, pulling them in via https://proxy.golang.org/ Example: https://play.golang.org/p/eqEo7mqdS9l 🎉 Multi-file support & few other things up next. Report bugs at golang/go issue 31944, or here on the tweeters. (On the "multiple file" support , see, since May

Can I import 3rd party package into golang playground

谁说我不能喝 提交于 2019-11-30 08:21:29
I googled but got no answer. Is it possible? If yes, how to do it? The Go Playground link: https://play.golang.org/ Since May 14th, 2019, it is now possible (from Brad Fitzpatrick )! The #golang playground now supports third-party imports, pulling them in via https://proxy.golang.org/ Example: https://play.golang.org/p/eqEo7mqdS9l 🎉 Multi-file support & few other things up next. Report bugs at golang/go issue 31944 , or here on the tweeters. (On the "multiple file" support , see, since May. 16th 2019, " Which packages may be imported in the go playground? ": see an example here ) netbrain

Which packages may be imported in the go playground?

本秂侑毒 提交于 2019-11-29 07:13:45
I had trouble finding a list of what packages may be imported in the go playground at http://play.golang.org/ . I was trying to use the (apparently experimental) package for ebnf . However even a short program won't import from golang.org (breaks on the import on line 4): package main import "fmt" import "golang.org/x/exp/ebnf" const g = ` Production = name "=" [ Expression ] "." . Expression = Alternative { "|" Alternative } . Alternative = Term { Term } . Term = name | token [ "…" token ] | Group | Option | Repetition . Group = "(" Expression ")" . Option = "[" Expression "]" . Repetition =