Documentation ¶
Index ¶
- func FileFromName(pkg *packages.Package, name string) *ast.File
- func FileFromPos(pkg *packages.Package, p Poser) *ast.File
- func FormatNode(fset *token.FileSet, node ast.Node) (string, []byte, error)
- type Info
- type Poser
- type RewriteMode
- type Rewriter
- func (r *Rewriter) FuncDef(pkgPath, stubVar string) (string, error)
- func (r *Rewriter) FuncNode(pkgPath, stubVar string) (*packages.Package, *ast.FuncLit)
- func (r *Rewriter) Load(paths ...string) error
- func (r *Rewriter) LookupFile(targetFileName string) *ast.File
- func (r *Rewriter) Print(root string) error
- func (r *Rewriter) Rewrite(mode RewriteMode, genContent bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RewriteMode ¶
type RewriteMode int
const ( ModeInvalid RewriteMode = iota ModeRewrite ModeReload )
type Rewriter ¶
type Rewriter struct { OutputDir string Pwd string Config packages.Config Pkgs []*packages.Package // Keys are PkgPath & stubVar name. We use PkgPath as the key instead // of a *packages.Package because we need to be able to find this across // different instances of Rewriter, where pointer values will be // different, but package import paths, which are just strings, will be // the same. NewFunc map[string]map[string]*ast.FuncLit // Per-package supplemental information. Used only in initial rewrite. Info map[*packages.Package]*Info // contains filtered or unexported fields }
func NewRewriter ¶
func NewRewriter() *Rewriter
Click to show internal directories.
Click to hide internal directories.