-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: -n flag shows Bash commands on all platforms. #5274
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
Labels
Comments
Checking the source: # pwd /root/go/root/src/cmd/go sob go # grep showcmd * build.go: b.showcmd("", "cp %s %s", src, dst) build.go:// showcmd prints the given command to standard output build.go:func (b *builder) showcmd(dir string, format string, args ...interface{}) { build.go: b.showcmd(dir, "%s", strings.Join(cmdline, " ")) build.go: b.showcmd("", "mkdir -p %s", dir) clean.go: b.showcmd(p.Dir, "rm -f %s", strings.Join(allRemove, " ")) clean.go: b.showcmd(p.Dir, "rm -r %s", name) clean.go: b.showcmd("", "rm -f %s", p.target) clean.go: b.showcmd("", "rm -f %s", target) run.go: b.showcmd("", "%s %s", a.deps[0].target, strings.Join(a.args, " ")) test.go: b.showcmd("", "%s", strings.Join(args, " ")) # I can see possible candidates: cp mkdir -p rm -f rm -r Assuming Go Authors would agree to change it, what would your replacements be? Your proposed alternatives aren't quite the same: "copy" and "del /f", unlike "cp" and "rm -f", will sometimes ask user questions. As to paths with "...", I don't have those. Perhaps, because I use tip. Can you, please, try tip or latest go1.1beta. Thank you. Alex Status changed to WaitingForReply. |
Sorry Alex. My suggestions may be incomplete becausd I reported this in a hurry.ñ, sorry about that, there are flags to avoid asking the user. I replaced those "..." by hand to make paths shorter they just pointed to my GOPATH I can add the original result later (it's 4:51 AM here, I need some sleep :/) if you want, it's something like "D:\Carlos\Dropbox\code\go" El 12/04/2013 04:44, <go@googlecode.com> escribió: |
Here is the full input of the commands: ----------------------------------------------------------------------------------------- D:\>go clean -n github.com/toqueteos/webbrowser cd D:\Carlos\Dropbox\code\go\src\github.com\toqueteos\webbrowser rm -f webbrowser webbrowser.exe webbrowser.test webbrowser.test.exe ----------------------------------------------------------------------------------------- D:\>go build -n github.com/toqueteos/webbrowser # # os/exec # mkdir -p $WORK\os\exec\_obj\ cd C:\go\src\pkg\os\exec C:\go\pkg\tool\windows_amd64\6g.exe -o $WORK\os\exec\_obj\_go_.6 -p os/exec -D _/C_/go/src/pkg/os/exec -I $WORK .\exec.go .\lp_windows.go C:\go\pkg\tool\windows_amd64\pack.exe grcP $WORK $WORK\os\exec.a $WORK\os\exec\_obj\_go_.6 # # github.com/toqueteos/webbrowser # mkdir -p $WORK\github.com\toqueteos\webbrowser\_obj\ cd D:\Carlos\Dropbox\code\go\src\github.com\toqueteos\webbrowser C:\go\pkg\tool\windows_amd64\6g.exe -o $WORK\github.com\toqueteos\webbrowser\_obj\_go_.6 -p github.com/toqueteos/webbrowser -D _/D_/Carlos/Dropbox/code/go/src/github.com/toqueteos/webbrowser -I $WORK .\doc.go .\webbrowser.go C:\go\pkg\tool\windows_amd64\pack.exe grcP $WORK $WORK\github.com\toqueteos\webbrowser.a $WORK\github.com\toqueteos\webbrowser\_obj\_go_.6 ----------------------------------------------------------------------------------------- D:\>go get -n github.com/toqueteos/webbrowser # # os/exec # mkdir -p $WORK\os\exec\_obj\ cd C:\go\src\pkg\os\exec C:\go\pkg\tool\windows_amd64\6g.exe -o $WORK\os\exec\_obj\_go_.6 -p os/exec -D _/C_/go/src/pkg/os/exec -I $WORK .\exec.go .\lp_windows.go C:\go\pkg\tool\windows_amd64\pack.exe grcP $WORK $WORK\os\exec.a $WORK\os\exec\_obj\_go_.6 mkdir -p C:\go\pkg\windows_amd64\os\ cp $WORK\os\exec.a C:\go\pkg\windows_amd64\os\exec.a # # github.com/toqueteos/webbrowser # mkdir -p $WORK\github.com\toqueteos\webbrowser\_obj\ cd D:\Carlos\Dropbox\code\go\src\github.com\toqueteos\webbrowser C:\go\pkg\tool\windows_amd64\6g.exe -o $WORK\github.com\toqueteos\webbrowser\_obj\_go_.6 -p github.com/toqueteos/webbrowser -D _/D_/Carlos/Dropbox/code/go/src/github.com/toqueteos/webbrowser -I $WORK .\doc.go .\webbrowser.go C:\go\pkg\tool\windows_amd64\pack.exe grcP $WORK $WORK\github.com\toqueteos\webbrowser.a $WORK\github.com\toqueteos\webbrowser\_obj\_go_.6 mkdir -p D:\Carlos\Dropbox\code\go\pkg\windows_amd64\github.com\toqueteos\ cp $WORK\github.com\toqueteos\webbrowser.a D:\Carlos\Dropbox\code\go\pkg\windows_amd64\github.com\toqueteos\webbrowser.a ----------------------------------------------------------------------------------------- It's not as trivial as I thought yesterday. Most of the time use an Ubuntu VM or MinGW so I can't help that much on this issue. - "del /F /Q" may behave the same as "rm -f". - "rmdir" (win) needs extensions to behave the same as "mkdir -p" (bash). There's also a third option which requires a bit more time, making a new go subcmd, such as replay: "go replay build github.com/toqueteos/webbrowser" And it does take the input and uses "os" and "os/exec" libraries to replay all the steps. |
Status changed to Duplicate. Merged into issue #5279. |
Moving conversation here https://golang.org/issue/5279?c=3. Alex |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by toqueteos:
The text was updated successfully, but these errors were encountered: