Skip to content

Install GoNx

How to install @naxodev/gonx in an existing Nx workspace and register the inference plugin.

  • An Nx 23.x workspace (or later)
  • Node.js 22+ (an active LTS release)
  • Go — a stable release (1.18+ for multi-module workspaces)

Don’t have a workspace yet? Create one with the gonx preset and skip to step 3:

npx create-nx-workspace my-org --preset=@naxodev/gonx

Each gonx major targets one Nx major:

Nx versiongonx version
21.x1.x, 2.x
22.x3.x
23.x4.x
  1. Install the package

    npm install @naxodev/gonx --save-dev

    Or with Nx’s built-in installer, which also runs any migrations:

    npx nx add @naxodev/gonx
  2. Register the inference plugin in nx.json

    Add @naxodev/gonx to the plugins array:

    {
      "plugins": ["@naxodev/gonx"]
    }

    The plugin infers Nx projects from every go.mod matched by **/go.mod. No per-project project.json is needed.

  3. Verify the plugin is loaded

    npx nx show projects

    Every directory containing a go.mod should appear as an Nx project. If you used the preset, your starter Go project will be listed.

To customize inferred target names or disable dependency detection, use the object form with options:

{
  "plugins": [
    {
      "plugin": "@naxodev/gonx",
      "options": {
        "buildTargetName": "build",
        "testTargetName": "test",
        "skipGoDependencyCheck": false
      }
    }
  ]
}

See the plugin options reference for every available option.