1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:34:40 -07:00

godoc: show source code if -src flag is set in command-line mode

This also shows the source code of exported functions in server
mode (e.g. pkg/big/?m=src).

Fixes #2360.

R=rsc
CC=golang-dev
https://golang.org/cl/5254057
This commit is contained in:
Robert Griesemer 2011-10-11 11:47:24 -07:00
parent 690d59fa3e
commit ec7963565a

View File

@ -1041,8 +1041,8 @@ func (h *httpHandler) getPageInfo(abspath, relpath, pkgname string, mode PageInf
if mode&noFiltering == 0 {
ast.PackageExports(pkg)
}
stripFunctionBodies(pkg)
if mode&showSource == 0 {
stripFunctionBodies(pkg)
pdoc = doc.NewPackageDoc(pkg, path.Clean(relpath)) // no trailing '/' in importpath
} else {
past = ast.MergePackageFiles(pkg, ast.FilterUnassociatedComments)