Skip to content

Commit

Permalink
fix: do not include file/lineno in error
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Jun 11, 2024
1 parent 2e42066 commit 5c0e222
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/neotest-golang/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand All @@ -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)
Expand Down

0 comments on commit 5c0e222

Please sign in to comment.