-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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/playground: support reading from os.Stdin #16667
Comments
There's no way to cache the results of an interactive program. |
Even thought it doesn't allow interactivity, you can read from os.Stdin on the playground if you assign it to another file. |
Yah, I expected that it would prevent caching, which certainly complicates matters. |
Besides caching difficulties, the program also needs to kept running for
much much longer, which means much more resource usage when there are a lot
concurrent users.
That being said, if you run playground locally, I don't why it can't
support interactive programs as it's already using websocket for transport.
|
Thanks for the input -- definitely some things I hadn't considered. I will continue writing Learn Go to use the Go playground without an expectation of this happening anytime soon. The section on branching with |
Playground is not supposed to be interactive platform. I would say implementing this feature requires another different beast than what we have. Don't want to be a party pooper but does it make sense to leave such bugs open when we cannot solve them, @andybons ? |
Yeah I think this is outside the (admittedly non-codified) scope of playground. Closing. |
Hi, #3806 (comment) suggests that using an input field / textarea might be simpler way of implementing this, and would actually allow to cache (and share) the program. If you guys think it makes sense to give it a try, I'd be happy to take over. |
@thebod thanks for the offer. We're not going to be adding this functionality any time in the near future. Perhaps if it was integrated into a playground alternative (e.g. https://goplay.space/) and became super popular we can reconsider, but for now we're going to go without it. |
It would be great if newcomers could write interactive programs in The Go Playground by reading from
os.Stdin
.E.g. https://play.golang.org/p/vYsHq3MUiO
Google Cloud Shell, nitrous.io, and c9.io have shell environments that support this, but they have associated fees and may be more complex than necessary for someone just starting out.
The text was updated successfully, but these errors were encountered: