var CmdGenerate … var generateRunFlag … var generateRunRE … var generateSkipFlag … var generateSkipRE … func init() { … } func runGenerate(ctx context.Context, cmd *base.Command, args []string) { … } // generate runs the generation directives for a single file. func generate(absFile string) bool { … } type Generator … // run runs the generators in the current file. func (g *Generator) run() (ok bool) { … } func isGoGenerate(buf []byte) bool { … } // setEnv sets the extra environment variables used when executing a // single go:generate command. func (g *Generator) setEnv() { … } // 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 { … } var stop … // 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) { … } // expandVar expands the $XXX invocation in word. It is called // by os.Expand. func (g *Generator) expandVar(word string) string { … } // setShorthand installs a new shorthand as defined by a -command directive. func (g *Generator) setShorthand(words []string) { … } // exec runs the command specified by the argument. The first word is // the command name itself. func (g *Generator) exec(words []string) { … }