/dap-go.nvim

nvim-dap extension to make simpler debug Golang using Delve

Primary LanguageLuaMIT LicenseMIT

dap-go.nvim

Golang with Delve over Debug Adapter Protocol for Neovim (>= 0.5)

What is DAP Go

dap-go.nvim is an extension for nvim-dap to configurate Go with Delve debugger.

Table of Content

Features

  • Load dap configurations from a file.

Getting Started

This section should guide you on how to add the extension to nvim-dap.

Dependencies

Suggested Dependencies

Installation

Using vim-plug

Plug 'nvim-lua/plenary.nvim'
Plug 'yriveiro/dap-go.nvim'

Using dein

call dein#add('nvim-lua/plenary.nvim')
call dein#add('yriveiro/dap-go.nvim')

Using packer.nvim

use {
  'yriveiro/dap-go.nvim',
  requires = { {'nvim-lua/plenary.nvim'} }
}

Usage

require('dap-go').setup()

Default options

See config.lua

Custom Configurations

If you want to use a json file to hold configurations for the debugger you need to enable the external config feature.

require('dap-go').setup({
  external_config = {
    enabled = true,
  }
})

An example of the dap-go.json file. This file can be used for custom configurations. The default path to search for is the current directory or git (if the current project is using git) root.

{
  "Custom config": {
    "type": "go",
    "name": "Debug custom",
    "request": "launch",
    "program": "${file}",
    "args": [
      "--foo",
      "bar"
    ],
    "options": {
      "env": {
        "FOO": "bar"
      }
    }
  }
}

Contributing

All contributions are welcome! Just open a pull request. Please read CONTRIBUTING.md

Acknowledgement

License

Licensed under the MIT License. Check the LICENSE file for details.