Generate executor
The generate executor runs code generation using go generate ./..., processing all //go:generate directives in the project tree.
nx run my-go-project:generate
Use nx run <project>:generate instead of nx generate <project> to avoid conflicts with Nx’s native generator command.
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
env | object | - | Environment variables to set when running the executor |
flags | string[] | - | Flags to pass to the go generate command |
Inferred target
Section titled “Inferred target”Inferred for all Go projects (applications and libraries):
{
"executor": "@naxodev/gonx:generate",
"cache": true,
"dependsOn": ["^generate"],
"inputs": ["goSource"]
}
The ^generate dependency means generate targets run after upstream project generate targets complete. Unlike build/test/lint/tidy, generate hashes only the project’s own goSource (no ^goSource) — go:generate directives only read the local module, and correctness relative to dependencies is already handled by the ^generate ordering above. See caching and inputs for details.