go.tools/cmd/godoc: search go.tools/cmd before $GOROOT/cmd
Fixes golang/go#6527. R=rsc CC=golang-dev https://golang.org/cl/14725043
This commit is contained in:
parent
851a7b980a
commit
36c288d6d7
|
@ -371,21 +371,21 @@ func main() {
|
|||
mode |= godoc.ShowSource
|
||||
}
|
||||
|
||||
// first, try as package unless forced as command
|
||||
// First, try as package unless forced as command.
|
||||
var info *godoc.PageInfo
|
||||
if !forceCmd {
|
||||
info = pres.GetPkgPageInfo(abspath, relpath, mode)
|
||||
}
|
||||
|
||||
// second, try as command unless the path is absolute
|
||||
// (the go command invokes godoc w/ absolute paths; don't override)
|
||||
// Second, try as command (if the path is not absolute).
|
||||
var cinfo *godoc.PageInfo
|
||||
if !filepath.IsAbs(path) {
|
||||
abspath = pathpkg.Join(pres.CmdFSRoot(), path)
|
||||
// First try go.tools/cmd.
|
||||
abspath = pathpkg.Join(pres.PkgFSRoot(), toolsPath+path)
|
||||
cinfo = pres.GetCmdPageInfo(abspath, relpath, mode)
|
||||
if cinfo.IsEmpty() {
|
||||
// Try go.tools/cmd if not found in $GOROOT/cmd.
|
||||
abspath = pathpkg.Join(pres.PkgFSRoot(), toolsPath+path)
|
||||
// Then try $GOROOT/cmd.
|
||||
abspath = pathpkg.Join(pres.CmdFSRoot(), path)
|
||||
cinfo = pres.GetCmdPageInfo(abspath, relpath, mode)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue