]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: show source code if -src flag is set in command-line mode
authorRobert Griesemer <gri@golang.org>
Tue, 11 Oct 2011 18:47:24 +0000 (11:47 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 11 Oct 2011 18:47:24 +0000 (11:47 -0700)
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

src/cmd/godoc/godoc.go

index cf2c0c43098414628b34c05f189c002fa2b1f66e..d436898a2c73b6fe62056debbc1b6a761fe2ac65 100644 (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)