]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: show "unexported" declarations when executing "godoc builtin"
authorRobert Griesemer <gri@golang.org>
Fri, 7 Oct 2011 19:45:19 +0000 (12:45 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 7 Oct 2011 19:45:19 +0000 (12:45 -0700)
Was never working correctly when executing from the command-line.

R=r
CC=golang-dev
https://golang.org/cl/5236042

src/cmd/godoc/godoc.go
src/cmd/godoc/main.go

index e348a0d45bed0dc3fd1e659b9de1d6f0ee6b25b0..8238dbb30465c54bff919d2ec2f3f5acb30bd70d 100644 (file)
@@ -811,7 +811,7 @@ const fakePkgName = "documentation"
 
 // Fake relative package path for built-ins. Documentation for all globals
 // (not just exported ones) will be shown for packages in this directory.
-const builtinPkgPath = "builtin/"
+const builtinPkgPath = "builtin"
 
 type PageInfoMode uint
 
@@ -1094,7 +1094,7 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
                return
        }
 
-       relpath := r.URL.Path[len(h.pattern):]
+       relpath := path.Clean(r.URL.Path[len(h.pattern):])
        abspath := absolutePath(relpath, h.fsRoot)
        mode := getPageInfoMode(r)
        if relpath == builtinPkgPath {
@@ -1123,7 +1123,7 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
                        title = "Package " + info.PDoc.PackageName
                case info.PDoc.PackageName == fakePkgName:
                        // assume that the directory name is the command name
-                       _, pkgname := path.Split(path.Clean(relpath))
+                       _, pkgname := path.Split(relpath)
                        title = "Command " + pkgname
                default:
                        title = "Command " + info.PDoc.PackageName
index 77f4946da95bd78abed86a5654b755a860ecd416..d05e03e0b34ea18c8cda3d39814eaee51bfc93bd 100644 (file)
@@ -387,6 +387,9 @@ func main() {
        }
 
        var mode PageInfoMode
+       if relpath == builtinPkgPath {
+               mode = noFiltering
+       }
        if *srcMode {
                // only filter exports if we don't have explicit command-line filter arguments
                if flag.NArg() > 1 {