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
cmd/go: support 'go run' reading from stdin #15540
Comments
Ping. |
We could use the argument "-" as a standin for standard input, that's pretty standard. |
Glad you're not being standoffish. I'll make a standalone CL we can look at. And if folks don't like it, I'll understand. |
@josharian Which places in the Go tree are you referring to? (I believe they exist, just none come to mind off hand.) |
/dev/stdin is the name I prefer for standard input. On Unix systems, the existence of that file (which I introduced oh so long ago for just this reason) means that no special per-command code is required. Everything just works. I never liked the "-" hack. |
That's a fine name also, but the special case code is still necessary because not all systems we run on have /dev/stdin. |
go run is just going to have to write the temp file. I don't think this is worth fixing. This is one step away from #!/bin/go, which we don't want to encourage as a way to write Go programs. |
We have a lot of places in the tree that generate code, write it to a temp file somewhere, go run it, and clean up the temp file. This would be a lot cleaner and simpler if we could simply pipe code into go run. For discussion.
The text was updated successfully, but these errors were encountered: