Install GoNx
import { Steps } from ‘@astrojs/starlight/components’;
How to install @naxodev/gonx in an existing Nx workspace and register the
inference plugin.
Before you start
Section titled “Before you start”- 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
npm install @naxodev/gonx --save-dev
Or with Nx’s built-in installer, which also runs any migrations:
npx nx add @naxodev/gonx
-
Register the inference plugin in
nx.jsonAdd
@naxodev/gonxto thepluginsarray:{ "plugins": ["@naxodev/gonx"] }The plugin infers Nx projects from every
go.modmatched by**/go.mod. No per-projectproject.jsonis needed. -
Verify the plugin is loaded
npx nx show projectsEvery directory containing a
go.modshould appear as an Nx project. If you used the preset, your starter Go project will be listed.
Configuration
Section titled “Configuration”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.
Next steps
Section titled “Next steps”- Quick start — create, run, test, and build a Go app
- Create your first Go project — a full tutorial walkthrough
- Application generator — scaffold a Go application
- Migrate to gonx 3.0.0 — coming from nx-go