Documentation ¶
Overview ¶
Package eg implements the example-based refactoring tool whose command-line is defined in github.com/polaris1119/go.tools/cmd/eg.
Index ¶
Constants ¶
const Help = `` /* 3388-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Transformer ¶
type Transformer struct {
// contains filtered or unexported fields
}
A Transformer represents a single example-based transformation.
func NewTransformer ¶
func NewTransformer(fset *token.FileSet, template *loader.PackageInfo, verbose bool) (*Transformer, error)
NewTransformer returns a transformer based on the specified template, a package containing "before" and "after" functions as described in the package documentation.
func (*Transformer) Transform ¶
Transform applies the transformation to the specified parsed file, whose type information is supplied in info, and returns the number of replacements that were made.
It mutates the AST in place (the identity of the root node is unchanged), and may add nodes for which no type information is available in info.
Derived from rewriteFile in $GOROOT/src/cmd/gofmt/rewrite.go.