Add an option for single package coverage. (#218)

pull/219/head
João Lucas Rafael 2 years ago committed by GitHub
parent d94f5df507
commit 6ed7dc5fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -226,6 +226,7 @@ first run of `GoFmt` may fail. It is recommended to run `GoInstallBinaries` to i
| GoGet {package_url} | go get package_url and restart gopls. Note1 |
| GoVet | go vet |
| GoCoverage | go test -coverprofile |
| GoCoverage -p | go test -coverprofile (only tests package for current buffer) |
| GoCoverage -f coverage_file_name | load coverage file |
| GoCoverage {flags} | -t : toggle, -r: remove signs, -R remove sings from all files, -m show metrics|
| GoTermClose | `closes the floating term` |

@ -349,7 +349,21 @@ M.run = function(...)
log(args2)
cmd = vim.list_extend(cmd, args2)
else
local argsstr = '.' .. utils.sep() .. '...'
local argsstr
if load == '-p' then
local pkg = require("go.package").pkg_from_path(nil, vim.api.nvim_get_current_buf())
if vfn.empty(pkg) == 1 then
util.log("No package found in current directory.")
return nil
end
argsstr = pkg[1]
else
argsstr = '.' .. utils.sep() .. '...'
end
table.insert(cmd, argsstr)
end

Loading…
Cancel
Save