Commit f566fca2 authored by Robert Griesemer's avatar Robert Griesemer

godoc: show "unexported" declarations when executing "godoc builtin"

Was never working correctly when executing from the command-line.

R=r
CC=golang-dev
https://golang.org/cl/5236042
parent 39b6fb7a
...@@ -811,7 +811,7 @@ const fakePkgName = "documentation" ...@@ -811,7 +811,7 @@ const fakePkgName = "documentation"
// Fake relative package path for built-ins. Documentation for all globals // Fake relative package path for built-ins. Documentation for all globals
// (not just exported ones) will be shown for packages in this directory. // (not just exported ones) will be shown for packages in this directory.
const builtinPkgPath = "builtin/" const builtinPkgPath = "builtin"
type PageInfoMode uint type PageInfoMode uint
...@@ -1094,7 +1094,7 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ...@@ -1094,7 +1094,7 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
relpath := r.URL.Path[len(h.pattern):] relpath := path.Clean(r.URL.Path[len(h.pattern):])
abspath := absolutePath(relpath, h.fsRoot) abspath := absolutePath(relpath, h.fsRoot)
mode := getPageInfoMode(r) mode := getPageInfoMode(r)
if relpath == builtinPkgPath { if relpath == builtinPkgPath {
...@@ -1123,7 +1123,7 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ...@@ -1123,7 +1123,7 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
title = "Package " + info.PDoc.PackageName title = "Package " + info.PDoc.PackageName
case info.PDoc.PackageName == fakePkgName: case info.PDoc.PackageName == fakePkgName:
// assume that the directory name is the command name // assume that the directory name is the command name
_, pkgname := path.Split(path.Clean(relpath)) _, pkgname := path.Split(relpath)
title = "Command " + pkgname title = "Command " + pkgname
default: default:
title = "Command " + info.PDoc.PackageName title = "Command " + info.PDoc.PackageName
......
...@@ -387,6 +387,9 @@ func main() { ...@@ -387,6 +387,9 @@ func main() {
} }
var mode PageInfoMode var mode PageInfoMode
if relpath == builtinPkgPath {
mode = noFiltering
}
if *srcMode { if *srcMode {
// only filter exports if we don't have explicit command-line filter arguments // only filter exports if we don't have explicit command-line filter arguments
if flag.NArg() > 1 { if flag.NArg() > 1 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment