Help us shape the future of Go! Take the 2026 Go Developer Survey

codemod

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 10 Imported by: 0

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

View Source
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

func AppendToReturn(src []byte, funcName, expr string, imports ...string) ([]byte, error)

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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