gops
List running Go processes
TLDR
Print all go processes running locally
Print more information about a process
Display a process tree
Print the current stack trace from a target program
Print the current runtime memory statistics
SYNOPSIS
gops [global-options] <command> [command-options] [arguments]
PARAMETERS
-agent=string
Path to gops agent binary.
Default: /tmp/gops-agent
-host=host:port
Host:port for agent listener.
Default: 127.0.0.1:0 (random port)
-quiet, -q
Suppress non-error stderr output
-v
Print version information and exit
DESCRIPTION
gops is a lightweight command-line utility for discovering and interacting with running Go programs. It enables developers to list active Go processes by PID or name and attach a debugger like Delve without rebuilding binaries.
It relies on a tiny agent binary placed at /tmp/gops-agent. At startup, Go runtimes (1.5+) automatically detect and load this agent if present and compatible with the architecture. The agent spawns a local TCP listener on a random localhost port, which gops uses to query process details or proxy debugger connections.
This approach is ideal for production debugging, as it requires no code changes or restarts. Simply install the agent once system-wide, then use gops ls to scan for processes and gops attach <PID> to debug. Filters narrow results by process name or PID patterns. Global flags customize agent discovery and output verbosity.
Security-focused: agents bind only to 127.0.0.1, preventing remote access.
CAVEATS
Agent must exist before Go processes start; restart processes to enable. Requires executable perms on agent (often sudo). Works on Go 1.5+; arch must match (e.g., amd64). Listeners localhost-only; no remote access. May fail if SELinux/AppArmor blocks dlopen.
SUBCOMMANDS
ls, list [filter]: List Go processes (filter by PID/regex name).
Options: -all (all procs), -json (JSON output).
attach, a <PID-or-name> [delve-args...]: Launch Delve attached via agent.
version, V: Show tool version.
AGENT SETUP
Download from GitHub releases (match arch/OS).
chmod +x gops-agent.linux-amd64
sudo mv gops-agent.linux-amd64 /tmp/gops-agent
Verify: ls -l /tmp/gops-agent
HISTORY
Created by Mitchell Hashimoto in 2016 (HashiCorp). Hosted on GitHub (mitchellh/gops). Designed for seamless prod debugging of Go apps without rebuilds. Actively maintained with releases for new Go versions/arches.


