summaryrefslogtreecommitdiff
path: root/src/cmd/go/tool.go
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2012-08-18 17:03:32 +1000
committerAlex Brainman <alex.brainman@gmail.com>2012-08-18 17:03:32 +1000
commite4f2067be12b41ed347ae0813189577b59ad1a55 (patch)
treee0087dcb6c579a3ea3836a93c0c74888492b732f /src/cmd/go/tool.go
parentf1f0ae946ec40d61a66d6bd256727e27fbf46a88 (diff)
downloadgo-e4f2067be12b41ed347ae0813189577b59ad1a55.tar.gz
pprof: make it work on windows again
- pprof is a perl script, so go command should invoke perl instead of trying to run pprof directly; - pprof should use "go tool nm" unconditionally on windows, no one else can extract symbols from Go program; - pprof should use "go tool nm" instead of "6nm". Fixes issue 3879. R=golang-dev, r CC=golang-dev http://codereview.appspot.com/6445082
Diffstat (limited to 'src/cmd/go/tool.go')
-rw-r--r--src/cmd/go/tool.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cmd/go/tool.go b/src/cmd/go/tool.go
index cb463a2e7..01e8ff6bb 100644
--- a/src/cmd/go/tool.go
+++ b/src/cmd/go/tool.go
@@ -47,7 +47,7 @@ const toolWindowsExtension = ".exe"
func tool(name string) string {
p := filepath.Join(toolDir, name)
- if toolIsWindows {
+ if toolIsWindows && name != "pprof" {
p += toolWindowsExtension
}
return p
@@ -76,6 +76,16 @@ func runTool(cmd *Command, args []string) {
setExitStatus(3)
return
}
+ if toolIsWindows && toolName == "pprof" {
+ args = append([]string{"perl", toolPath}, args[1:]...)
+ var err error
+ toolPath, err = exec.LookPath("perl")
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "go tool: perl not found\n")
+ setExitStatus(3)
+ return
+ }
+ }
if toolN {
fmt.Printf("%s %s\n", toolPath, strings.Join(args[1:], " "))