Documentation
¶
Overview ¶
Package codemod edits Go source the way a developer would: it appends an element to the slice literal returned by a known function and adds the imports it needs. Registration in Vukem apps is plain code (no init(), no reflection), so generators use this to wire what they create.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMarkerNotFound = errors.New("codemod: marker not found")
ErrMarkerNotFound means the file no longer has the expected shape (func Name() []T { return []T{ ... } }); callers print the snippet for the user to add by hand instead.
Functions ¶
func AppendToReturn ¶
AppendToReturn appends expr to the composite literal returned by funcName and adds the import paths. It is idempotent: an element whose source text equals expr is not added twice. local is the module path of the project being edited, so an added import lands in the group gci sorts it into; "" treats every path as belonging to another module.
Types ¶
This section is empty.