From 5c0e222f4e9f93dd1e27533a95d7016ac8201bfd Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Tue, 11 Jun 2024 21:24:27 +0200 Subject: [PATCH] fix: do not include file/lineno in error --- lua/neotest-golang/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/neotest-golang/init.lua b/lua/neotest-golang/init.lua index d7e54807..060f299b 100644 --- a/lua/neotest-golang/init.lua +++ b/lua/neotest-golang/init.lua @@ -260,7 +260,7 @@ function M.Adapter.results(spec, result, tree) -- record an error ---@type string local matched_line_number = - string.match(line.Output, test_filename .. ":(%d+)") + string.match(line.Output, test_filename .. ":(%d+):") if matched_line_number ~= nil then -- attempt to parse the line number... @@ -269,9 +269,13 @@ function M.Adapter.results(spec, result, tree) if line_number ~= nil then -- log the error along with its line number (for diagnostics) + + ---@type string + local message = string.match(line.Output, ":%d+: (.*)") + ---@type neotest.Error local error = { - message = line.Output, + message = message, line = line_number - 1, -- neovim lines are 0-indexed } table.insert(errors, error)