There is gotests-vim as a plugin to handle gotests with vim.
This is a Lua rewrite for Neovim.
Gotests-vim requires gotests to be available in your $PATH
. Alternatively you
can provide path to gotests using g:gotests_bin
setting.
{
"yanskun/gotests.nvim",
ft = "go",
config = function()
require("gotests").setup()
end,
},
use {
'yanskun/gotests.nvim',
ft = 'go',
config = function()
require('gotests').setup()
end
}
Command | Description |
---|---|
:GoTests |
generate tests for functions at the current line or functions selected in visual mode. |
:GoTestsAll |
generate tests for all functions and methods |
If you want you can set path to your gotests binary if it's not in your path, for example:
let g:gotests_bin = '/home/user/go/bin/gotests'
You can also set custom template directory:
let g:gotests_template_dir = '/home/user/templates/'