Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 28, 2026·3 min de lectura

Delve — Interactive Debugger for Go Programs

Delve is a full-featured debugger for Go that understands goroutines, deferred calls, and the Go runtime. It provides breakpoints, variable inspection, expression evaluation, and stack traces for any Go program or test.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Delve Debugger
Comando de instalación directa
npx -y tokrepo@latest install 18f5c2c0-5ad3-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

Delve is a purpose-built debugger for the Go programming language. Unlike general-purpose debuggers such as GDB, Delve understands Go's concurrency primitives, goroutine scheduling, and runtime internals, giving developers accurate inspection of their programs without the impedance mismatch that comes from adapting C-oriented tools to Go.

What Delve Does

  • Sets breakpoints, conditional breakpoints, and tracepoints in Go source code
  • Inspects local and global variables, struct fields, slices, maps, and interfaces
  • Evaluates arbitrary Go expressions at runtime
  • Navigates goroutine stacks and switches between goroutines
  • Attaches to running processes or core dumps for post-mortem analysis

Architecture Overview

Delve operates as a client-server architecture. The backend (dlv) controls the target process via OS-level ptrace (Linux) or Mach APIs (macOS) and exposes a JSON-RPC or DAP (Debug Adapter Protocol) API. Frontends such as VS Code, GoLand, or the built-in terminal UI connect to this API, making Delve the shared foundation for Go debugging across editors.

Self-Hosting & Configuration

  • Install with go install github.com/go-delve/delve/cmd/dlv@latest
  • Works out of the box on Linux (amd64, arm64), macOS, and Windows
  • Configure via ~/.config/dlv/config.yml for aliases, source paths, and substitution rules
  • Supports remote debugging with dlv --headless --listen=:2345
  • Integrates with VS Code through the official Go extension's launch.json

Key Features

  • First-class goroutine awareness with per-goroutine stack traces
  • DAP protocol support for seamless IDE integration
  • Conditional and hit-count breakpoints for targeted debugging
  • Core dump analysis for post-mortem debugging
  • Call injection to execute functions in the debuggee's context

Comparison with Similar Tools

  • GDB — general-purpose but struggles with Go runtime structures and goroutines
  • LLDB — powerful on macOS but lacks Go-specific support
  • GoLand built-in — uses Delve as its backend under the hood
  • VS Code Go debugger — also powered by Delve via DAP
  • print debugging — zero setup but no interactive inspection or breakpoints

FAQ

Q: Does Delve support Go generics? A: Yes, Delve fully supports debugging generic functions and types since Go 1.18.

Q: Can I debug tests with Delve? A: Yes, use dlv test ./pkg/... to debug test binaries directly.

Q: How does remote debugging work? A: Run dlv --headless --listen=:2345 exec ./app on the server, then connect from your local editor to that address.

Q: Does Delve slow down my program? A: The debuggee runs at near-native speed between breakpoints. Breakpoint hits pause execution, which is standard debugger behavior.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados