Documentation ¶
Overview ¶
Package doc extracts source code documentation from a Go AST.
Index ¶
- Variables
- func ParseFiles(fset *token.FileSet, filenames []string, mode parser.Mode) (pkgs map[string]*ast.Package, pkgsfiles []string, first error)
- func PrintFileOutline(filename string, w io.Writer, sep string, showexpr bool) error
- func PrintFilesTree(filenames []string, w io.Writer, expr bool) error
- type Filter
- type FuncDoc
- type PackageDoc
- type PackageView
- func (p *PackageView) PrintFuncs(w io.Writer, level int, tag_folder string)
- func (p *PackageView) PrintHeader(w io.Writer, level int)
- func (p *PackageView) PrintImports(w io.Writer, level int, tag, tag_folder string)
- func (p *PackageView) PrintPackage(w io.Writer, level int)
- func (p *PackageView) PrintTodos(w io.Writer, level int, tag, tag_folder string)
- func (p *PackageView) PrintTree(w io.Writer)
- func (p *PackageView) PrintTypeFields(w io.Writer, decl *ast.GenDecl, level int)
- func (p *PackageView) PrintTypes(w io.Writer, types []*TypeDoc, level int)
- func (p *PackageView) PrintVars(w io.Writer, vars []*ValueDoc, level int, tag string, tag_folder string)
- type TodoDoc
- type TypeDoc
- type ValueDoc
- Bugs
Constants ¶
This section is empty.
Variables ¶
View Source
var AllFiles []string
View Source
var Command = &command.Command{
Run: runAstView,
UsageLine: "astview [-stdin] files...",
Short: "print go files astview",
Long: `print go files astview`,
}
Functions ¶
func ParseFiles ¶
func PrintFileOutline ¶ added in v1.5.0
level,tag,pos@info
Types ¶
type FuncDoc ¶
type FuncDoc struct { Doc string Recv ast.Expr // TODO(rsc): Would like string here Name string Decl *ast.FuncDecl }
FuncDoc is the documentation for a func declaration, either a top-level function or a method function.
type PackageDoc ¶
type PackageDoc struct { PackageName string ImportPath string Imports []string Filenames []string Doc string Consts []*ValueDoc Types []*TypeDoc Vars []*ValueDoc Funcs []*FuncDoc Factorys []*FuncDoc Todos []*TodoDoc Bugs []string }
PackageDoc is the documentation for an entire package.
func NewFileDoc ¶
func NewFileDoc(file *ast.File, showAll bool) *PackageDoc
func NewPackageDoc ¶
func NewPackageDoc(pkg *ast.Package, importpath string, showAll bool) *PackageDoc
func (*PackageDoc) Filter ¶
func (p *PackageDoc) Filter(f Filter)
Filter eliminates documentation for names that don't pass through the filter f. TODO: Recognize "Type.Method" as a name.
type PackageView ¶
type PackageView struct {
// contains filtered or unexported fields
}
func NewFilePackage ¶
func NewFilePackage(filename string) (*PackageView, error)
func NewFilePackageSource ¶
func NewPackageView ¶
func (*PackageView) PrintFuncs ¶
func (p *PackageView) PrintFuncs(w io.Writer, level int, tag_folder string)
func (*PackageView) PrintHeader ¶
func (p *PackageView) PrintHeader(w io.Writer, level int)
func (*PackageView) PrintImports ¶
func (p *PackageView) PrintImports(w io.Writer, level int, tag, tag_folder string)
func (*PackageView) PrintPackage ¶
func (p *PackageView) PrintPackage(w io.Writer, level int)
func (*PackageView) PrintTodos ¶
func (p *PackageView) PrintTodos(w io.Writer, level int, tag, tag_folder string)
func (*PackageView) PrintTypeFields ¶
func (*PackageView) PrintTypes ¶
func (p *PackageView) PrintTypes(w io.Writer, types []*TypeDoc, level int)
type TypeDoc ¶
type TypeDoc struct { Doc string Type *ast.TypeSpec Consts []*ValueDoc Vars []*ValueDoc Funcs []*FuncDoc Methods []*FuncDoc Decl *ast.GenDecl // contains filtered or unexported fields }
TypeDoc is the documentation for a declared type. Consts and Vars are sorted lists of constants and variables of (mostly) that type. Factories is a sorted list of factory functions that return that type. Methods is a sorted list of method functions on that type.
Notes ¶
Bugs ¶
Click to show internal directories.
Click to hide internal directories.