Skip to content

Application generator

Generates a Go application under the given directory and registers it as an Nx project through the gonx inference plugin. Aliased as app.

nx g @naxodev/gonx:application <directory>
OptionTypeDefaultDescription
directorystringrequiredDirectory of the new application. Taken from the first positional argument.
namestring-Name of the application. Must match ^[a-zA-Z][^:]*$.
templatestandard | cli | tuistandardApplication template to generate.
tagsstring-Tags to add to the application (used for linting).
skipFormatbooleanfalseSkip formatting files.
  • Runs the init generator first to register the inference plugin in nx.json.
  • Creates a go.mod for the project unless the template already includes one. Adds the project to go.work when a Go workspace is present.
  • Inferred targets for applications: build, serve, test, lint, tidy, generate, nx-release-publish. Application detection requires a main.go containing package main and func main(, or a cmd/ directory.