From 2d076b5ec051bca338e3695f5b8370b9f6a0f8a6 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Fri, 6 Sep 2024 21:33:08 +0200 Subject: [PATCH] feat: show error from 'go list' and exit --- lua/neotest-golang/lib/cmd.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/neotest-golang/lib/cmd.lua b/lua/neotest-golang/lib/cmd.lua index d227c810..36fdd12c 100644 --- a/lua/neotest-golang/lib/cmd.lua +++ b/lua/neotest-golang/lib/cmd.lua @@ -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