Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RefactorFile ¶
func RefactorFile(filename string, rules RewriteRules) (bool, error)
RefactorFile applies the rewrite rules to the given Go file. It returns true if the file was modified.
Types ¶
type RewriteRules ¶
type RewriteRules struct {
// ImportPathMap maps old import paths to new import paths.
ImportPathMap map[string]string
// PackageNameMap maps old package names to new package names.
PackageNameMap map[string]string
// TypeNameMap maps old type names to new type names (e.g., "model.Context" -> "Scope").
// The key is the full identifier or just the name if it's in the same package.
TypeNameMap map[string]string
// FunctionNameMap maps old function names to new function names.
// The key is the full identifier or just the name if it's in the same package.
FunctionNameMap map[string]string
// VariableNameMap maps old variable names to new variable names,
// optionally filtered by their type name.
VariableNameMap map[string]VariableRename
// MethodNameMap maps old method names to new method names.
// The key is the type-qualified method name (e.g., "model.Scope.VariableWithValueGraph").
MethodNameMap map[string]string
}
RewriteRules defines the mappings for import paths, package names, types, and variables.
type VariableRename ¶
Click to show internal directories.
Click to hide internal directories.