Functions
errorf
method
#
errorf logs an error message prefixed with the file and line number.
It then exits the program (with exit status 1) because generation stops
at the first error.
func (g *Generator) errorf(format string, args ...any)
exec
method
#
exec runs the command specified by the argument. The first word is
the command name itself.
func (g *Generator) exec(words []string)
expandVar
method
#
expandVar expands the $XXX invocation in word. It is called
by os.Expand.
func (g *Generator) expandVar(word string) string
generate
function
#
generate runs the generation directives for a single file.
func generate(absFile string) bool
init
function
#
func init()
isGoGenerate
function
#
func isGoGenerate(buf []byte) bool
run
method
#
run runs the generators in the current file.
func (g *Generator) run() (ok bool)
runGenerate
function
#
func runGenerate(ctx context.Context, cmd *base.Command, args []string)
setEnv
method
#
setEnv sets the extra environment variables used when executing a
single go:generate command.
func (g *Generator) setEnv()
setShorthand
method
#
setShorthand installs a new shorthand as defined by a -command directive.
func (g *Generator) setShorthand(words []string)
split
method
#
split breaks the line into words, evaluating quoted
strings and evaluating environment variables.
The initial //go:generate element is present in line.
func (g *Generator) split(line string) []string