explaingit

google/gops

7,015GoAudience · developerComplexity · 2/5Setup · easy

TLDR

Command-line tool that lets you inspect any running Go program, list processes, view memory and CPU usage, and collect performance profiles without changing your code.

Mindmap

mindmap
  root((gops))
    What it does
      List Go processes
      Show memory usage
      Collect profiles
      Trigger garbage collection
    How to use
      Local process ID
      Remote hostname port
      Embed agent library
    Diagnostics
      CPU profiling
      Memory stats
      Call stack
      Runtime settings
    Audience
      Go developers
      Performance engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

List all running Go programs on a machine and see which Go version built them.

USE CASE 2

Collect a CPU or memory profile from a live Go application for performance analysis.

USE CASE 3

Remotely diagnose memory usage of a Go server running on another machine.

USE CASE 4

Manually trigger garbage collection and change GC thresholds in a running Go app.

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 5min
License details are not described in the explanation.

In plain English

gops is a command-line tool for inspecting Go programs running on your computer. Go is a programming language, and programs written in it have internal details like goroutines (lightweight threads), memory usage, and garbage collection settings that are not normally visible from the outside. gops gives you a way to see and interact with those details while the program is running. Running gops with no arguments lists all Go processes currently active on the machine, showing each one's process ID, parent process ID, name, the version of Go it was built with, and where the binary lives on disk. You can then pass a specific process ID to get a more detailed view: CPU usage, memory usage, the user who started it, and active network connections. For deeper diagnostics, you can embed a small agent library into your own Go program. Once that agent is running inside your program, gops can connect to it and retrieve the current call stack, memory statistics, and runtime settings. You can also trigger garbage collection manually, change the garbage collection threshold, and collect CPU or memory profiles for performance analysis. Profiles open interactively in the standard Go profiling tool. gops supports both local use (connecting to programs on the same machine by process ID) and remote use (connecting to programs on other machines by hostname and port, if the agent is configured to listen remotely). The tool is from Google and is installed with a single Go command.

Copy-paste prompts

Prompt 1
I have a Go HTTP server using google/gops. Show me how to embed the gops agent so I can collect live CPU profiles without restarting the server.
Prompt 2
Using gops, write a shell script that lists all running Go processes, filters for ones built with Go 1.21+, and dumps their memory stats to a file.
Prompt 3
I want to remotely connect gops to a Go app running on my VPS. Walk me through configuring the agent to listen on a specific port with auth.
Prompt 4
My Go app is using too much memory. Using gops, show me step by step how to get a heap profile and open it in pprof to find the leak.
Open on GitHub → Explain another repo

← google on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.