Skip to content

cmd plugin debug

github-actions[bot] edited this page Apr 26, 2026 · 2 revisions

nself plugin debug

Attach a Delve debugger to a plugin process for step-through debugging.

Synopsis

nself plugin debug <name> [flags]

Description

Builds the named plugin with debug symbols disabled (-gcflags=all=-N -l), then starts it under dlv exec --headless. Auto-allocates a port from the 2345-2399 range and prints a VS Code launch.json snippet you can paste directly.

Multiple plugins can be debugged simultaneously, each gets its own port from the range.

Flags

Flag Default Description
--port 0 (auto) Debugger listen port (auto-allocates from 2345-2399 if 0)
--port-only false Print the allocated port and exit (for scripting)

Examples

# Start debugger on auto-allocated port
nself plugin debug myplugin

# Use a specific port
nself plugin debug myplugin --port 2350

# Print port for scripting
PORT=$(nself plugin debug myplugin --port-only)
echo "Connect on :$PORT"

# Combined with nself plugin dev (in two terminals)
# Terminal 1:
nself plugin dev myplugin --no-link --debug
# Terminal 2 (VS Code attach or dlv connect):
dlv connect :2345

Output

Building myplugin for debug...
Plugin built at /tmp/nself-debug-myplugin
Starting dlv on :2345...
--- VS Code launch.json snippet ---
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach to myplugin",
      "type": "go",
      "request": "attach",
      "mode": "remote",
      "remotePath": "${workspaceFolder}",
      "port": 2345,
      "host": "127.0.0.1"
    }
  ]
}
---
GoLand: Run > Attach to Process > Remote... > host=127.0.0.1, port=2345
---

Prerequisites

Install Delve:

go install github.com/go-delve/delve/cmd/dlv@latest

Port Allocation

Ports 2345-2399 are the debug port range (55 simultaneous sessions). If the range is exhausted, use --port to specify a port outside the range.

The port is also exposed via --port-only for automation:

nself plugin debug myplugin --port-only   # prints :2345

Security Note

--accept-multiclient is a development-only flag and is NOT enabled in production builds. The debugger only listens on 127.0.0.1, never exposed to external networks.

See Also

Home


Getting Started


Commands


Features


Configuration


Plugins (87 + 10 monitoring)

Free (25)
Pro (62)
Planned (26)
  • plugin-audit
  • plugin-blog
  • plugin-checkout
  • plugin-commerce
  • plugin-drm
  • plugin-export
  • plugin-flow
  • plugin-import
  • plugin-ldap
  • plugin-mailgun
  • plugin-media
  • plugin-oauth-providers
  • plugin-pages
  • plugin-postmark
  • plugin-rate-limit
  • plugin-reports
  • plugin-saml
  • plugin-scheduler
  • plugin-sendgrid
  • plugin-sso
  • plugin-subscription
  • plugin-thumb
  • plugin-transcoder
  • plugin-twilio
  • plugin-waf
  • plugin-watermark

Guides


Architecture


Reference


Licensing


Security


Brand


Operations


Contributing


Changelog

Clone this wiki locally