coc-golang

Test explorer

Browse, run, and check the status of Go tests from a tree view.

go.test.explorer.show opens the Go Tests tree view — a browsable tree of every test and benchmark in your workspace.

:CocCommand go.test.explorer.show

What the tree shows

Tests are nested folder → package → file → test → subtest. Each node carries the status of the tests beneath it:

  • ✓ passed, ✗ failed, ● running, ○ skipped.
  • Parent nodes show a summary such as 3 passed · 1 failed.
  • A test's tooltip has its file and line, how long it took, and its captured output.

Run and jump

Run any node — a test, file, package, or folder runs everything beneath it.

TaskCommand
Open the treego.test.explorer.show
Run the selected nodego.test.explorer.run
Jump to the selected node's filego.test.explorer.open
Run everythinggo.test.explorer.runAll
Re-scan the workspacego.test.explorer.refresh
Pick a single test from a listgo.test.explorer

The tree is a normal coc.nvim tree buffer, so its built-in keys work. See :h coc-tree and :h coc-tree-filter.

Keys

nnoremap <leader>gt :CocCommand go.test.explorer.show<CR>
nnoremap <leader>gr :CocCommand go.test.explorer.run<CR>
nnoremap <leader>go :CocCommand go.test.explorer.open<CR>

The tree refreshes itself when a _test.go file is saved.

On this page