mirror of
https://github.com/golang/go
synced 2024-11-13 17:20:22 -07:00
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
This commit is contained in:
parent
39b6fb7a19
commit
f566fca2b3
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user