]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: don't print spurious suggestion when running "go doc foo"
authorRobert Griesemer <gri@golang.org>
Fri, 17 Feb 2012 19:01:16 +0000 (11:01 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 17 Feb 2012 19:01:16 +0000 (11:01 -0800)
Fixes #3041.

R=rsc
CC=golang-dev
https://golang.org/cl/5671087

src/cmd/godoc/main.go

index e5e81c6dfa19b63a7a5e1b3c19ae648ba2feb078..96b729978f76ac371766dfdfb8b0375fc5474044 100644 (file)
@@ -417,11 +417,13 @@ func main() {
                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) {
                abspath = absolutePath(path, cmdHandler.fsRoot)
+               cinfo = cmdHandler.getPageInfo(abspath, relpath, "", mode)
        }
-       cinfo := cmdHandler.getPageInfo(abspath, relpath, "", mode)
 
        // determine what to use
        if info.IsEmpty() {