Skip to content

Commit

Permalink
made go list cmd building be more inline with style in plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
augbed committed Sep 4, 2024
1 parent f88f965 commit 8c513de
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions lua/neotest-golang/lib/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,16 @@ local M = {}

function M.golist_data(cwd)
-- call 'go list -json {go_list_args...} ./...' to get test file data
local go_list_command = {
"go",
"list",
"-json",
}

-- combine base command, user args and packages(./...)
vim.list_extend(
vim.list_extend(go_list_command, options.get().go_list_args or {}),
{ "./..." }
)
local cmd = { "go", "list", "-json" }
vim.list_extend(cmd, options.get().go_list_args or {})
vim.list_extend(cmd, { "./..."})

local go_list_command_concat = table.concat(go_list_command, " ")
local go_list_command_concat = table.concat(cmd, " ")
logger.debug("Running Go list: " .. go_list_command_concat .. " in " .. cwd)
local output = vim
.system(go_list_command, { cwd = cwd, text = true })
.system(cmd, { cwd = cwd, text = true })
:wait().stdout or ""
if output == "" then
logger.error({ "Execution of 'go list' failed, output:", output })
Expand Down

0 comments on commit 8c513de

Please sign in to comment.