godoc: don't print spurious suggestion when running "go doc foo"

Fixes #3041.

R=rsc
CC=golang-dev
https://golang.org/cl/5671087
This commit is contained in:
Robert Griesemer 2012-02-17 11:01:16 -08:00
parent f7ce57b1c8
commit 6cdf0a1eab
1 changed files with 4 additions and 2 deletions

View File

@ -417,11 +417,13 @@ func main() {
info = pkgHandler.getPageInfo(abspath, relpath, "", mode) info = pkgHandler.getPageInfo(abspath, relpath, "", mode)
} }
// second, try as command // second, try as command unless the path is absolute
// (the go command invokes godoc w/ absolute paths; don't override)
var cinfo PageInfo
if !filepath.IsAbs(path) { if !filepath.IsAbs(path) {
abspath = absolutePath(path, cmdHandler.fsRoot) abspath = absolutePath(path, cmdHandler.fsRoot)
cinfo = cmdHandler.getPageInfo(abspath, relpath, "", mode)
} }
cinfo := cmdHandler.getPageInfo(abspath, relpath, "", mode)
// determine what to use // determine what to use
if info.IsEmpty() { if info.IsEmpty() {