Quick start
import { Steps } from ‘@astrojs/starlight/components’;
Create a Go application with Nx, then run, test, and build it using targets that
gonx infers from go.mod.
Before you start
Section titled “Before you start”- Node.js 20+ and an Nx 23.x workspace
- Go — a stable release (1.18+ for multi-module workspaces)
gonx 3.x targets Nx 23.x:
| Nx version | gonx version |
|---|---|
| 23.x | 3.x |
-
Create a Go application
cd go-workspace npx nx g @naxodev/gonx:application my-go-appThe generator creates a Go project with a
package mainentry point. gonx detects thego.modand infersbuild,serve,test,lint,tidy, andgeneratetargets. Pass--templateto choosestandard,cli, ortui. See the application generator guide for all options. -
Run the application
npx nx serve my-go-appThe
servetarget runsgo runfrom the project root. See the serve executor guide. -
Test the project
npx nx test my-go-appThe
testtarget runsgo test. See the test executor guide. -
Build the project
npx nx build my-go-appThe
buildtarget compiles an executable. See the build executor guide.
Verify
Section titled “Verify”List the projects Nx detected and the targets inferred for your application:
npx nx show projects
npx nx show project my-go-app
nx show project lists the build, serve, test, lint, tidy, and
generate targets with no project.json file. Run npx nx build my-go-app a
second time to confirm caching — the second run is served from the Nx cache.
Next steps
Section titled “Next steps”- Create your first Go project — a full walkthrough with explanations
- Install GoNx — add gonx to an existing workspace
- Plugin options — customize target names and tags
- Migrate to gonx 3.0.0 — coming from nx-go