Documentation ¶
Overview ¶
Package loader contains Go source loading utilities.
Index ¶
- Variables
- func Load(path string) ([]*packages.Package, error)
- func LoadComments(decl ast.Decl) (comments *ast.CommentGroup)
- func LoadOne(path string) (macro.Context, error)
- func LoadPackage(dir, pattern string, environ []string) ([]*packages.Package, error)
- func LoadReader(r io.Reader, name string) (macro.Context, error)
- func LoadWalk(path string, cb func(l Loaded, ctx macro.Context) error) error
- type Loaded
- type LoadedPackages
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExpectedOnlyOnePackage = errors.New("expected only one package")
ErrExpectedOnlyOnePackage reports that loader found several packages, but expected only one.
Functions ¶
func LoadComments ¶
func LoadComments(decl ast.Decl) (comments *ast.CommentGroup)
LoadComments gets comments from given declaration.
func LoadPackage ¶
LoadPackage loads packages from pattern using given workdir and environment.
func LoadReader ¶
LoadReader loads source from io.Reader.
Types ¶
type Loaded ¶
type Loaded struct { Packages LoadedPackages Module *packages.Module }
Loaded contains loaded module information.
type LoadedPackages ¶
LoadedPackages is a container of loaded packages.
func (LoadedPackages) Add ¶
func (l LoadedPackages) Add(pkg *packages.Package)
Add marks package as loaded.
func (LoadedPackages) Has ¶
func (l LoadedPackages) Has(path string) bool
Has denotes that package already has been loaded.
Click to show internal directories.
Click to hide internal directories.