Skip to content

Configuration to run golang tests under GDB #94

@ezaquarii

Description

@ezaquarii

Native dlv is not supported on all platforms, but gdb has pretty decent go support that works for most cases.

Here is my snippet that allowed me to debug go test file with a simple C-x C-a d on OpenBSD:

;; .dir-locals.el
((nil . ((dape-configs . ((go-test
			  modes (go-mode go-ts-mode)
			  command "gdb"
			  command-args ("--interpreter=dap")
			  command-cwd (file-name-directory (buffer-file-name))
			  compile "go test -c -o /tmp/test.bin -gcflags '-N -l'"
			  :request "launch"
			  :program "/tmp/test.bin"
			  :args []
			  :stopAtBeginningOfMainSubprogram nil))))))

This probably can benefit from more massaging, but is it something you'd be keen on adding to the release? @svaante

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions