package edit
import "honnef.co/go/tools/analysis/edit"
Package edit contains helpers for creating suggested fixes.
Index ¶
- func Delete(old Ranger) analysis.TextEdit
- func Fix(msg string, edits ...analysis.TextEdit) analysis.SuggestedFix
- func ReplaceWithNode(fset *token.FileSet, old Ranger, new ast.Node) analysis.TextEdit
- func ReplaceWithPattern(fset *token.FileSet, old Ranger, new pattern.Pattern, state pattern.State) analysis.TextEdit
- func ReplaceWithString(old Ranger, new string) analysis.TextEdit
- func Selector(x, sel string) *ast.SelectorExpr
- type Range
- type Ranger
Functions ¶
func Delete ¶
Delete deletes a range of code.
func Fix ¶
func Fix(msg string, edits ...analysis.TextEdit) analysis.SuggestedFix
func ReplaceWithNode ¶
ReplaceWithNode replaces a range with an AST node.
func ReplaceWithPattern ¶
func ReplaceWithPattern(fset *token.FileSet, old Ranger, new pattern.Pattern, state pattern.State) analysis.TextEdit
ReplaceWithPattern replaces a range with the result of executing a pattern.
func ReplaceWithString ¶
ReplaceWithString replaces a range with a string.
func Selector ¶
func Selector(x, sel string) *ast.SelectorExpr
Selector creates a new selector expression.
Types ¶
type Range ¶
Range implements the Ranger interface.
func (Range) End ¶
func (Range) Pos ¶
type Ranger ¶
Ranger describes values that have a start and end position. In most cases these are either ast.Node or manually constructed ranges.
Source Files ¶
edit.go
- Version
- v0.5.0-rc.1
- Published
- Jul 1, 2024
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 7 minutes ago –
Tools for package owners.