<p dir="auto">by <strong>axel.schreiner</strong>:</p>
<pre class="notranslate">godoc binds GOPATH/src to /src/pkg;
i.e., directories below GOPATH/src contain packages, not commands;
i.e., HTTP requests for /cmd/FOO only work if FOO is in GOROOT/src/cmd.

Looks to me like godoc cannot readily document user-written commands outside GOROOT. (I
kludged this using -path; however, it's a very awkward, undocumented kludge.)

Note that the distributed directory structure is GOROOT/src/pkg for packages and
GOROOT/src/cmd for commands.

If godoc/main.go/main() were changed, e.g., to

    // Bind $GOPATH trees into Go root.
    for _, p := range filepath.SplitList(build.Default.GOPATH) {
        fs.Bind("/src/pkg", OS(p), "/src/pkg", bindAfter)
        fs.Bind("/src/cmd", OS(p), "/src/cmd", bindAfter)
    }

then HTTP requests /pkg/FOO and /cmd/FOO would document user packages in
GOPATH/src/pkg/FOO and commands in GOPATH/src/cmd/FOO, respectively. (This does,
however, break the current interpretation of GOPATH for godoc).

Alternatively,

    // Bind $GOPATH trees into Go root.
    for _, p := range filepath.SplitList(build.Default.GOPATH) {
        fs.Bind("/src/cmd", OS(p), "/src/cmd", bindAfter)
        fs.Bind("/src/pkg", OS(p), "/src", bindAfter)
    }

would not break the current interpretation of GOPATH and would also document user
commands. (The package list in this case shows a package 'cmd' containing directories
for user commands.)

The option -path only applies to packages because it binds each path /FOO/BAR to
/src/pkg/BAR,
i.e., an HTTP request /pkg/BAR will produce documentation from /FOO/BAR.

One could add another option -cmds to godoc/godoc.go/initHandlers() to bind paths to
/src/cmd to allow single user commands to be added to the server:

var ...
    cmdPath = flag.String("cmds", "", "additional command directories (colon-separated)")

initHandler...

    // Add named directories in -cmds argument as
    // subdirectories of src/cmd.
    for _, p := range filepath.SplitList(*cmdPath) {
        _, elem := filepath.Split(p)
        if elem == "" {
            log.Fatalf("invalid -cmds argument: %q has no final element", p)
        }
        fs.Bind("/src/cmd/"+elem, OS(p), "/", bindReplace)
    }

Which operating system are you using?
MacOS X 10.8

Which version are you using?  (run 'go version')
go1</pre>
<pre class="notranslate">Well, since pprof is actually a perl script. It just doesn't work on windows. "go
tool" assumes that every tool ends with the ".exe" suffix on microsoft
operating system and pprof isn't.

Perhaps it should be removed from tool directory on windows at all? It's under
"misc" anyways, if someone really wants to use it with mingw or cygwin
environment it is possible to do.

Or perhaps there is some other way to make it work.</pre>