Skip to content

Serve Executor

Terminal window
nx serve my-go-app
OptionTypeDefaultDescription
mainstring-Relative path from the project root to the main.go file defining the binary
cmdstring”go”Name of the go binary to use
argsstring[]-Extra args when starting the app
envobject-Environment variables to set when running the application
{
"executor": "@naxodev/gonx:serve",
"continuous": true,
"options": {}
}
Terminal window
nx serve my-go-app
Terminal window
nx serve my-go-app --main=cmd/server/main.go

This will run the application using the main.go file located at cmd/server/main.go relative to the project root.

Terminal window
nx serve my-go-app --args="--port=8080,--debug"
  • Automatically discovers main.go files when no explicit main file is specified
  • Uses the official go run commands in the background, but it can be overridden to use any other command
  • When main option is specified, the serve command runs from the directory containing the main.go file
  • If no main option is provided, the serve command will discover and run the main package in the project root