]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: add URL mode m=methods
authorRobert Griesemer <gri@golang.org>
Mon, 30 Jan 2012 22:07:50 +0000 (14:07 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 30 Jan 2012 22:07:50 +0000 (14:07 -0800)
If set, all methods are shown, not just those
of non-exported anonynous fields.

This change will only become functional once
CL 5576057 is submitted.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5599048

src/cmd/godoc/doc.go
src/cmd/godoc/godoc.go

index acea2b5d06c4793f026f4491b2631c994eead8b6..3fad1b0d66bc039c774f942fc3977aee2b4d27ec 100644 (file)
@@ -131,7 +131,8 @@ shown, and only an identifier index but no full text search index is created.
 The presentation mode of web pages served by godoc can be controlled with the
 "m" URL parameter; it accepts a comma-separated list of flag names as value:
 
-       all     show documentation for all (not just exported) declarations
+       all     show documentation for all declarations, not just the exported ones
+       methods show all embedded methods, not just those of unexported anonymous fields
        src     show the original source code rather then the extracted documentation
        text    present the page in textual (command-line) form rather than HTML
        flat    present flat (not indented) directory listings using full paths
index 86983fbe17d18b8342aaff58a19364aed9693627..916ef6808d6bae157e56b92cca0b73f9735c319d 100644 (file)
@@ -867,6 +867,7 @@ type PageInfoMode uint
 
 const (
        noFiltering PageInfoMode = 1 << iota // do not filter exports
+       allMethods                           // show all embedded methods
        showSource                           // show source code, do not extract documentation
        noHtml                               // show result in textual form, do not generate HTML
        flatDir                              // show directory in a flat (non-indented) manner
@@ -874,10 +875,11 @@ const (
 
 // modeNames defines names for each PageInfoMode flag.
 var modeNames = map[string]PageInfoMode{
-       "all":  noFiltering,
-       "src":  showSource,
-       "text": noHtml,
-       "flat": flatDir,
+       "all":     noFiltering,
+       "methods": allMethods,
+       "src":     showSource,
+       "text":    noHtml,
+       "flat":    flatDir,
 }
 
 // getPageInfoMode computes the PageInfoMode flags by analyzing the request
@@ -1088,6 +1090,9 @@ func (h *httpHandler) getPageInfo(abspath, relpath, pkgname string, mode PageInf
                        if mode&noFiltering != 0 {
                                m = doc.AllDecls
                        }
+                       if mode&allMethods != 0 {
+                               m |= doc.AllMethods
+                       }
                        pdoc = doc.New(pkg, path.Clean(relpath), m) // no trailing '/' in importpath
                } else {
                        // show source code