mirror of
https://github.com/golang/go
synced 2024-11-21 23:34:42 -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
|
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:
|
"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
|
src show the original source code rather then the extracted documentation
|
||||||
text present the page in textual (command-line) form rather than HTML
|
text present the page in textual (command-line) form rather than HTML
|
||||||
flat present flat (not indented) directory listings using full paths
|
flat present flat (not indented) directory listings using full paths
|
||||||
|
@ -867,6 +867,7 @@ type PageInfoMode uint
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
noFiltering PageInfoMode = 1 << iota // do not filter exports
|
noFiltering PageInfoMode = 1 << iota // do not filter exports
|
||||||
|
allMethods // show all embedded methods
|
||||||
showSource // show source code, do not extract documentation
|
showSource // show source code, do not extract documentation
|
||||||
noHtml // show result in textual form, do not generate HTML
|
noHtml // show result in textual form, do not generate HTML
|
||||||
flatDir // show directory in a flat (non-indented) manner
|
flatDir // show directory in a flat (non-indented) manner
|
||||||
@ -874,10 +875,11 @@ const (
|
|||||||
|
|
||||||
// modeNames defines names for each PageInfoMode flag.
|
// modeNames defines names for each PageInfoMode flag.
|
||||||
var modeNames = map[string]PageInfoMode{
|
var modeNames = map[string]PageInfoMode{
|
||||||
"all": noFiltering,
|
"all": noFiltering,
|
||||||
"src": showSource,
|
"methods": allMethods,
|
||||||
"text": noHtml,
|
"src": showSource,
|
||||||
"flat": flatDir,
|
"text": noHtml,
|
||||||
|
"flat": flatDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
// getPageInfoMode computes the PageInfoMode flags by analyzing the request
|
// 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 {
|
if mode&noFiltering != 0 {
|
||||||
m = doc.AllDecls
|
m = doc.AllDecls
|
||||||
}
|
}
|
||||||
|
if mode&allMethods != 0 {
|
||||||
|
m |= doc.AllMethods
|
||||||
|
}
|
||||||
pdoc = doc.New(pkg, path.Clean(relpath), m) // no trailing '/' in importpath
|
pdoc = doc.New(pkg, path.Clean(relpath), m) // no trailing '/' in importpath
|
||||||
} else {
|
} else {
|
||||||
// show source code
|
// show source code
|
||||||
|
Loading…
Reference in New Issue
Block a user