v0.4.7 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 6 Imported by: 11



Package edit contains helpers for creating suggested fixes.



This section is empty.


This section is empty.


func Delete

func Delete(old Ranger) analysis.TextEdit

Delete deletes a range of code.

func Fix

func Fix(msg string, edits ...analysis.TextEdit) analysis.SuggestedFix

func ReplaceWithNode

func ReplaceWithNode(fset *token.FileSet, old Ranger, new ast.Node) analysis.TextEdit

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

func ReplaceWithString(old Ranger, new string) analysis.TextEdit

ReplaceWithString replaces a range with a string.

func Selector

func Selector(x, sel string) *ast.SelectorExpr

Selector creates a new selector expression.


type Range

type Range [2]token.Pos

Range implements the Ranger interface.

func (Range) End

func (r Range) End() token.Pos

func (Range) Pos

func (r Range) Pos() token.Pos

type Ranger

type Ranger interface {
	Pos() token.Pos
	End() token.Pos

Ranger describes values that have a start and end position. In most cases these are either ast.Node or manually constructed ranges.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL