Skip to content
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

Closed
josharian opened this issue May 4, 2016 · 8 comments
Closed

cmd/go: support 'go run' reading from stdin #15540

josharian opened this issue May 4, 2016 · 8 comments

Comments

@josharian
Copy link
Contributor

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.

@bradfitz bradfitz added this to the Unplanned milestone May 4, 2016
@bradfitz
Copy link
Contributor

bradfitz commented May 4, 2016

/cc @rsc @robpike @ianlancetaylor

@josharian
Copy link
Contributor Author

Ping.

@bradfitz bradfitz modified the milestones: Go1.8Maybe, Unplanned Jul 13, 2016
@randall77
Copy link
Contributor

We could use the argument "-" as a standin for standard input, that's pretty standard.
I stand by that statement.

@josharian
Copy link
Contributor Author

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.

@mdempsky
Copy link
Member

@josharian Which places in the Go tree are you referring to? (I believe they exist, just none come to mind off hand.)

@robpike
Copy link
Contributor

robpike commented Jul 13, 2016

/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.

@randall77
Copy link
Contributor

That's a fine name also, but the special case code is still necessary because not all systems we run on have /dev/stdin.

@rsc
Copy link
Contributor

rsc commented Oct 20, 2016

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.

@rsc rsc closed this as completed Oct 20, 2016
@golang golang locked and limited conversation to collaborators Oct 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants