Exec go test under cursor easily.
- gott (required)
Install:
go install github.com/sshelll/gott/v2@latest
**Note: the version ofgottshould be greater than v2.0.0, **which means you should not use
go install github.com/sshelll/gott@latest
- nvim-notify (required)
Install: check https://github.com/rcarriga/nvim-notify for more details.
- vim-dispatch (optional)
This plug allows you run test async, check https://github.com/tpope/vim-dispatch for more details.
Use your nvim plug manager.
Such as: Plug 'sshelll/gott.nvim'
Gott
Run go test under cursor. For example:
:Gott
:Gott -v
:Gott -v -race
:Gott -vet=off -raceGottFile
Run all go tests of the current buffer. For example:
:GottFile
:GottFile -v
:GottFile -v -race
:GottFile -vet=off -raceGottClear
Clear all the notifications.
-
GottAsyncRun go test under cursor async. You have to install vim-dispatch first.
-
GottFileAsyncRun all go tests of the current buffer async. You have to install vim-dispatch first.
require('gott').setup{
timeout = 3000, -- try to close go test result notification after 3s.
keep = function () -- decide whether to keep the notification after timeout(3s).
return false
end,
render = 'default', -- default / minimal / simple / compact, controls the notification style.
test_args = '-v -race', -- these args will be passed to go test command at any time.
}The default conf is:
require('gott').setup{
keep = function () -- keep the notification after timeout, which means the notification window will not be closed.
return true -- if you want to close them, just call ':GottClear'.
end,
render = 'default',
test_args = '-v -vet=off',
}