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
|
mode |= godoc.ShowSource
|
||||||
}
|
}
|
||||||
|
|
||||||
// first, try as package unless forced as command
|
// First, try as package unless forced as command.
|
||||||
var info *godoc.PageInfo
|
var info *godoc.PageInfo
|
||||||
if !forceCmd {
|
if !forceCmd {
|
||||||
info = pres.GetPkgPageInfo(abspath, relpath, mode)
|
info = pres.GetPkgPageInfo(abspath, relpath, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// second, try as command unless the path is absolute
|
// Second, try as command (if the path is not absolute).
|
||||||
// (the go command invokes godoc w/ absolute paths; don't override)
|
|
||||||
var cinfo *godoc.PageInfo
|
var cinfo *godoc.PageInfo
|
||||||
if !filepath.IsAbs(path) {
|
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)
|
cinfo = pres.GetCmdPageInfo(abspath, relpath, mode)
|
||||||
if cinfo.IsEmpty() {
|
if cinfo.IsEmpty() {
|
||||||
// Try go.tools/cmd if not found in $GOROOT/cmd.
|
// Then try $GOROOT/cmd.
|
||||||
abspath = pathpkg.Join(pres.PkgFSRoot(), toolsPath+path)
|
abspath = pathpkg.Join(pres.CmdFSRoot(), path)
|
||||||
cinfo = pres.GetCmdPageInfo(abspath, relpath, mode)
|
cinfo = pres.GetCmdPageInfo(abspath, relpath, mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue