Documentation
¶
Overview ¶
Package parser parses Go files into an AST that can be easily formatted.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
Decls []Decl
// contains filtered or unexported fields
}
File bundles an ast.File and a token.FileSet. It is more convenient to work with than its underlying objects when operating on only one file at a time.
func ParseFile ¶
ParseFile parses the source code of a single Go source file and returns the corresponding File. The name and src parameters operate as in go/parser.ParseFile.
func (*File) ImportDecls ¶
func (f *File) ImportDecls() []*ImportDecl
func (*File) ImportSpecs ¶
func (f *File) ImportSpecs() []ImportSpec
ImportSpecs returns all the imports specifications from all the import declarations in the file.
type ImportDecl ¶
type ImportDecl struct {
Doc *ast.CommentGroup
Specs []ImportSpec
Pos, End token.Pos
}
ImportDecl represents an import declaration in a File.
type ImportSpec ¶
type ImportSpec struct {
ast.ImportSpec
}
ImportSpec represents an import specification in an ImportDecl.
func (*ImportSpec) Path ¶
func (i *ImportSpec) Path() string
Click to show internal directories.
Click to hide internal directories.