diff --git a/src/cmd/doc/main.go b/src/cmd/doc/main.go index 0499c40369..dee5d7bbcd 100644 --- a/src/cmd/doc/main.go +++ b/src/cmd/doc/main.go @@ -110,6 +110,13 @@ func do(writer io.Writer, flagSet *flag.FlagSet, args []string) (err error) { if buildPackage == nil { return fmt.Errorf("no such package: %s", userPath) } + + // The builtin package needs special treatment: its symbols are lower + // case but we want to see them, always. + if buildPackage.ImportPath == "builtin" { + unexported = true + } + symbol, method = parseSymbol(sym) pkg := parsePackage(writer, buildPackage, userPath) paths = append(paths, pkg.prettyPath()) @@ -128,12 +135,6 @@ func do(writer io.Writer, flagSet *flag.FlagSet, args []string) (err error) { panic(e) }() - // The builtin package needs special treatment: its symbols are lower - // case but we want to see them, always. - if pkg.build.ImportPath == "builtin" { - unexported = true - } - // We have a package. if showAll && symbol == "" { pkg.allDoc()