mirror of
https://github.com/golang/go
synced 2024-11-21 23:24:41 -07:00
godoc: add URL mode m=methods
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
This commit is contained in:
parent
260db6ea5a
commit
ff451e8670
@ -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
|
||||
|
@ -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
|
||||
@ -875,6 +876,7 @@ const (
|
||||
// modeNames defines names for each PageInfoMode flag.
|
||||
var modeNames = map[string]PageInfoMode{
|
||||
"all": noFiltering,
|
||||
"methods": allMethods,
|
||||
"src": showSource,
|
||||
"text": noHtml,
|
||||
"flat": flatDir,
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user