Documentation
¶
Overview ¶
Package godoc implements the core logic for retrieving and parsing Go documentation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDocumentation ¶
GetDocumentation retrieves the documentation for a package or symbol as Markdown.
func GetDocumentationWithFallback ¶
GetDocumentationWithFallback attempts to retrieve documentation for a package. If the specific package documentation is not found, it attempts to find documentation for parent paths (module roots) and returns it with a hint.
func ListSubPackages ¶
ListSubPackages finds sub-packages within a directory using go list.
Types ¶
type Doc ¶
type Doc struct {
Package string `json:"package"`
ImportPath string `json:"importPath"`
ResolvedPath string `json:"resolvedPath,omitempty"`
SymbolName string `json:"symbolName,omitempty"`
Type string `json:"type,omitempty"` // "function", "type", "var", "const"
Definition string `json:"definition,omitempty"`
Description string `json:"description"`
Examples []Example `json:"examples,omitempty"`
SubPackages []string `json:"subPackages,omitempty"`
PkgGoDevURL string `json:"pkgGoDevURL"`
// Lists of symbols (signatures or summaries)
Funcs []string `json:"funcs,omitempty"`
Types []string `json:"types,omitempty"`
Vars []string `json:"vars,omitempty"`
Consts []string `json:"consts,omitempty"`
// Extra fields for Describe superset
SourcePath string `json:"sourcePath,omitempty"`
Line int `json:"line,omitempty"`
References []string `json:"references,omitempty"`
}
Doc represents the parsed documentation.
func Extract ¶
Extract returns documentation from an already loaded packages.Package. It is efficient (no I/O) as it reuses the existing AST and Type information. Use this when you have a *packages.Package available.