Skip to content

Commit

Permalink
feat: show error from 'go list' and exit
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Sep 6, 2024
1 parent 83ee03a commit 2d076b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/neotest-golang/lib/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ function M.golist_data(cwd)

local go_list_command_concat = table.concat(cmd, " ")
logger.debug("Running Go list: " .. go_list_command_concat .. " in " .. cwd)
local output = vim.system(cmd, { cwd = cwd, text = true }):wait().stdout or ""
if output == "" then
logger.error({ "Execution of 'go list' failed, output:", output })
local result = vim.system(cmd, { cwd = cwd, text = true }):wait()
if result.code == 1 then
logger.error({ "execution of 'go list' failed, output:", result.stderr })
end
local output = result.stdout or ""
return json.decode_from_string(output)
end

Expand Down

0 comments on commit 2d076b5

Please sign in to comment.