Skip to content

Install GoNx

import { Steps } from ‘@astrojs/starlight/components’;

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

  • An Nx 23.x workspace (or later)
  • Node.js 20+
  • 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
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
  1. 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.

  2. 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.