Skip to content

Library generator

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

nx g @naxodev/gonx:library <directory>
Option Type Default Description
directory string (required) The directory of the new library. Accepted as the first positional argument.
name string - The name of the library.
tags string - Add tags to the library (used for linting).
skipFormat boolean false Skip formatting files.
  • Runs the init generator first to register the inference plugin in nx.json.
  • Always creates a go.mod for the project. Adds the project to go.work when a Go workspace is present.
  • Inferred targets for libraries: test, lint, tidy, generate, nx-release-publish. Libraries do not infer build or serve.