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: print shell commands safely #5279

Open
robpike opened this issue Apr 12, 2013 · 10 comments
Open

cmd/go: print shell commands safely #5279

robpike opened this issue Apr 12, 2013 · 10 comments
Milestone

Comments

@robpike
Copy link
Contributor

robpike commented Apr 12, 2013

The printing of commands by the go tool is simple-minded, can be incorrect in the face
of empty strings and other issues, ignores system-dependent issues ($foo vs %foo;
quoting, etc.) and should be improved. The current setup just calls Printf or special
formatting routines that sometimes (not always) expand variables, and ignore local
quoting and other conventions (rm vs. del for example). It's not important but it is
worth doing right.

It's a big job.
@robpike
Copy link
Contributor Author

robpike commented Apr 12, 2013

Comment 1:

Issue #5274 has been merged into this issue.

@gopherbot
Copy link

Comment 2 by toqueteos:

I'm sorry Rob I forgot to search for "shell".
Is the idea of a replay command suitable or it's better to ouput native shell commands?

@alexbrainman
Copy link
Member

Comment 3:

To sumup from https://golang.org/issue/5274. Possible unix to
windows command translation candidates:
"cp" -> "copy /y" 
"mkdir -p" -> "mkdir"
"rm -f" -> "del /f /q" for files and "rmdir /s /q" for directories
"rm -r" -> same as before
Alex

@alexbrainman
Copy link
Member

Comment 4:

Issue #5274 has been merged into this issue.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 5:

I am not sure it is worth doing right.
The printing of commands by the go tool is meant to be informational, not a working
shell script.

@alexbrainman
Copy link
Member

Comment 6:

I am with rsc on this. I suspect correct windows translation could be complicated (too
many unusual parameters options) or impossible to do correctly. I think clarity is most
important here.
Alex

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 7:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@bcmills
Copy link
Contributor

bcmills commented Sep 16, 2019

The printing of commands by the go tool is meant to be informational, not a working
shell script.

As of CL 55350 (for #21427), we do have a test that the output of at least a very basic go build -x is a working shell script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants