Documentation ¶
Index ¶
- type AliasPackage
- func (alias *AliasPackage) AddConst(decl *ast.GenDecl) (err error)
- func (alias *AliasPackage) AddFunc(decl *ast.FuncDecl) (err error)
- func (alias *AliasPackage) AddGeneral(decl *ast.GenDecl) error
- func (alias *AliasPackage) AddType(decl *ast.GenDecl) (err error)
- func (alias AliasPackage) ModelFile() (result *ast.File)
- func (alias *AliasPackage) SetModelFile(val *ast.File)
- type ErrorUnexpectedToken
- type PackageFinder
- type PackageWalker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliasPackage ¶
func NewAliasPackage ¶
func NewAliasPackage(original *ast.Package, originalLocation string) (alias *AliasPackage, err error)
NewAliasPackage stuff and things
func (*AliasPackage) AddConst ¶
func (alias *AliasPackage) AddConst(decl *ast.GenDecl) (err error)
AddConst adds a Const block with indiviual aliases for each Spec in `decl`.
func (*AliasPackage) AddFunc ¶
func (alias *AliasPackage) AddFunc(decl *ast.FuncDecl) (err error)
AddFunc creates a stub method to redirect the call to the original package, then adds it to the model file.
func (*AliasPackage) AddGeneral ¶
func (alias *AliasPackage) AddGeneral(decl *ast.GenDecl) error
AddGeneral handles dispatching a GenDecl to either AddConst or AddType.
func (*AliasPackage) AddType ¶
func (alias *AliasPackage) AddType(decl *ast.GenDecl) (err error)
AddType adds a Type delcaration block with individual alias for each Spec handed in `decl`
func (AliasPackage) ModelFile ¶
func (alias AliasPackage) ModelFile() (result *ast.File)
ModelFile is a getter for the file accumulating aliased content.
func (*AliasPackage) SetModelFile ¶
func (alias *AliasPackage) SetModelFile(val *ast.File)
SetModelFile is a setter for the file accumulating aliased content.
type ErrorUnexpectedToken ¶
func (ErrorUnexpectedToken) Error ¶
func (utoken ErrorUnexpectedToken) Error() string
type PackageFinder ¶
type PackageFinder struct {
// contains filtered or unexported fields
}
PackageFinder traverses a directory looking for Go Packages that could be aliased.
func NewPackageFinder ¶
func NewPackageFinder(root string) *PackageFinder
NewPackageFinder creates a new instance of PackageFinder with an initialized value of `Root`.
func (PackageFinder) Enumerate ¶
func (finder PackageFinder) Enumerate(cancel <-chan struct{}) collection.Enumerator
Enumerate traverses a directory parsing aliasable packages. The type passed to the channel is `string` which are paths to directories containing a parsable go package.
func (PackageFinder) Root ¶
func (finder PackageFinder) Root() string
Root fetches the value that a PackageFinder will begin searching in.
func (*PackageFinder) SetRoot ¶
func (finder *PackageFinder) SetRoot(val string)
SetRoot sets the value that a PackageFInder should use for its search.
type PackageWalker ¶
type PackageWalker struct {
// contains filtered or unexported fields
}
PackageWalker traverses an `*ast.Package` looking for top-level declarations of Constants, Functions, Types, or Variables.
func (PackageWalker) Enumerate ¶
func (pw PackageWalker) Enumerate(cancel <-chan struct{}) collection.Enumerator
Enumerate traverses package content in order of its files lexographically sorted.