diff --git a/godoc/godoc.go b/godoc/godoc.go index 86575f60f7..0681a5adb7 100644 --- a/godoc/godoc.go +++ b/godoc/godoc.go @@ -33,7 +33,9 @@ import ( ) // 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, +// and there will be no association of consts, vars, and factory functions +// with types (see issue 6645). const builtinPkgPath = "builtin" // FuncMap defines template functions used in godoc templates. diff --git a/godoc/server.go b/godoc/server.go index b03e14a6e9..693599b4dc 100644 --- a/godoc/server.go +++ b/godoc/server.go @@ -268,7 +268,10 @@ func (h *handlerServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { abspath := pathpkg.Join(h.fsRoot, relpath) mode := h.p.GetPageInfoMode(r) if relpath == builtinPkgPath { - mode = NoFiltering | NoTypeAssoc + // The fake built-in package contains unexported identifiers, + // but we want to show them. Also, disable type association, + // since it's not helpful for this fake package (see issue 6645). + mode |= NoFiltering | NoTypeAssoc } info := h.GetPageInfo(abspath, relpath, mode, r.FormValue("GOOS"), r.FormValue("GOARCH")) if info.Err != nil { @@ -357,7 +360,7 @@ const ( AllMethods // show all embedded methods ShowSource // show source code, do not extract documentation FlatDir // show directory in a flat (non-indented) manner - NoTypeAssoc // don't associate consts, vars, and factory functions with types + NoTypeAssoc // don't associate consts, vars, and factory functions with types (not exposed via ?m= query parameter, used for package builtin, see issue 6645) ) // modeNames defines names for each PageInfoMode flag.