feat(adapters): add GoAdapter driving dlv dap#3
Closed
niradler wants to merge 1 commit into
Closed
Conversation
Second PR in the multi-language stack. Stacks on top of #2 (Adapter ABC refactor); merge that first. GoAdapter implements the Adapter contract for Go programs: * spawn `dlv dap --listen=127.0.0.1:<port>` as the DAP server, with a clear "delve not installed" error pointing at the `go install` command when `dlv` isn't on PATH (no cryptic ENOENT). * launch payload uses `mode: "debug"` so delve compiles + runs in one step from a `.go` file or package directory. * `spawn_listen_mode` for IDE attach (VS Code Go extension dap-mode). * `parse_traceback` understands both `panic:` and `fatal error:` dumps, including extended runtime frames with `+0xN fp=0x... sp=0x... pc=0x...` annotations. Frames stored oldest-first (matches Python convention) so the shared `deepest_user_frame` heuristic lands on the panic site. * runtime / sync / reflect / internal frames are marked `is_user_code=False` so the deepest-user heuristic skips runtime scaffolding when reporting crash locations. * `resolve_launch_target` peels `go run [-flags] <main.go> args...` into `(main.go, args)` for `dbga diagnose`. `go test` is out of scope (would need `mode: "test"`); it returns None and surfaces the crash without rerun, matching the existing Python `-m` behavior. CLI surface: $ dbga session start --break-at main.go:12 -- main.go $ dbga diagnose --timeout 30 -- go run main.go $ dbga localize --lang go --file panic.txt Language is auto-detected from the script extension; `--lang go` forces it. Test plan: * 14 new unit tests (`tests/unit/test_go_adapter.py`) covering registry, detection, listen-mode flag, launch-payload shape, `go run` peeling, panic + fatal-error parsing, and the missing-dlv error path. * 1 new integration test (`tests/integration/test_go_session.py`) drives real `dlv dap`: initialize / launch / stopOnEntry / continue / terminated. Auto-skips when `dlv` or `go` isn't on PATH so the suite stays green on Python-only machines. * `__debug_bin*` + `*.test` added to .gitignore — `dlv dap` leaves the compiled debug binary in cwd. Local validation: - 76 unit tests pass (61 prior + 14 new + 1 misc). - 8 integration tests pass (7 Python + 1 Go) — driven against real delve 1.22+ on Windows. - 45 e2e tests pass unchanged. - ruff check + ruff format + mypy --strict all clean. Out of scope for this PR (deferred to future work): - `go test ./...` debugging (needs DAP `mode: "test"` + `--test.run` plumbing). - `dbga instrument` probe templates for Go (`fmt.Println` defaults).
This was referenced May 29, 2026
Owner
Author
niradler
added a commit
that referenced
this pull request
May 29, 2026
…E usage guidance node-expert: make the top-level evidence stance unconditional (mirrors python-expert rule #3) so the RUNTIME-VERIFIED/INSPECTION-ONLY labeling discipline applies to review/audit tasks, not just crash-fix flows. README: add usage guidance (architect delegation cliff, review-vs-debug expectations, opus override for hard single-language tasks).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second PR in the multi-language stack. Stacks on top of #2 (Adapter ABC refactor) — merge that first; once merged, this PR's base will be
main.GoAdapterimplements the Adapter contract for Go programs:dlv dap --listen=127.0.0.1:<port>, with a clear "delve not installed" error pointing at thego installcommand whendlvisn't on PATH (no cryptic ENOENT).mode: "debug"so delve compiles + runs in one step from a.gofile or package directory.spawn_listen_modefor IDE attach (VS Code Go extension dap-mode).parse_tracebackunderstands bothpanic:andfatal error:dumps, including extended runtime frames with+0xN fp=0x... sp=0x... pc=0x...annotations. Frames stored oldest-first so the shareddeepest_user_frameheuristic lands on the panic site.runtime.*/sync.*/reflect.*/internal/*frames are markedis_user_code=False.resolve_launch_targetpeelsgo run [-flags] <main.go> args...into(main.go, args)fordbga diagnose.go testis out of scope (would needmode: "test").CLI
Language is auto-detected from the script extension;
--lang goforces it.Test plan
tests/unit/test_go_adapter.py) — registry, detection, listen-mode flag, launch-payload shape,go runpeeling, panic + fatal-error parsing, missing-dlv error path.tests/integration/test_go_session.py) — drives realdlv dapend-to-end (initialize / launch / stopOnEntry / continue / terminated). Auto-skips whendlvorgoisn't on PATH.uv run pytest -v— 128 passed (61 unit + 14 Go unit + 1 misc, 8 integration, 45 e2e), driven against real delve 1.22+ on Windows.uv run ruff check .cleanuv run ruff format --check .cleanuv run mypy srcclean (29 files)__debug_bin*+*.testadded to.gitignore(dlv dapleaves the compiled binary in cwd).Out of scope (deferred)
go test ./...debugging (needs DAPmode: "test"+--test.runplumbing).dbga instrumentprobe templates for Go (fmt.Printlndefaults).Stack