|
|
@ -79,7 +79,7 @@ function M.make(...)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local runner = vim.split(makeprg, ' ')[1]
|
|
|
|
local runner = vim.split(makeprg, " ")[1]
|
|
|
|
|
|
|
|
|
|
|
|
if not require("go.install").install(runner) then
|
|
|
|
if not require("go.install").install(runner) then
|
|
|
|
util.warn("please wait for " .. runner .. " to be installed and re-run the command")
|
|
|
|
util.warn("please wait for " .. runner .. " to be installed and re-run the command")
|
|
|
@ -156,7 +156,7 @@ function M.make(...)
|
|
|
|
table.insert(cmd, "-v")
|
|
|
|
table.insert(cmd, "-v")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if optarg["r"] then
|
|
|
|
if optarg["r"] then
|
|
|
|
log("run test")
|
|
|
|
log("run test", efm)
|
|
|
|
table.insert(cmd, "-run")
|
|
|
|
table.insert(cmd, "-run")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if compile_test then
|
|
|
|
if compile_test then
|
|
|
@ -191,6 +191,9 @@ function M.make(...)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local failed = false
|
|
|
|
local failed = false
|
|
|
|
local itemn = 1
|
|
|
|
local itemn = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local package_path = cmd[#cmd]
|
|
|
|
|
|
|
|
local pkg_len = #package_path
|
|
|
|
local function on_event(job_id, data, event)
|
|
|
|
local function on_event(job_id, data, event)
|
|
|
|
-- log("stdout", data, event)
|
|
|
|
-- log("stdout", data, event)
|
|
|
|
if event == "stdout" then
|
|
|
|
if event == "stdout" then
|
|
|
@ -200,15 +203,22 @@ function M.make(...)
|
|
|
|
if value:find("=== RUN") or value:find("no test file") then
|
|
|
|
if value:find("=== RUN") or value:find("no test file") then
|
|
|
|
goto continue
|
|
|
|
goto continue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
value = handle_color(value)
|
|
|
|
value = handle_color(value)
|
|
|
|
if value:find("FAIL") then
|
|
|
|
if value:find("FAIL") then
|
|
|
|
failed = true
|
|
|
|
failed = true
|
|
|
|
|
|
|
|
if value == "FAIL" then
|
|
|
|
|
|
|
|
goto continue
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local changed = false
|
|
|
|
local changed = false
|
|
|
|
if vim.fn.empty(vim.fn.glob(args[#args])) == 0 then
|
|
|
|
if vim.fn.empty(vim.fn.glob(args[#args])) == 0 then
|
|
|
|
changed = true
|
|
|
|
changed = true
|
|
|
|
if value:find("FAIL") == nil then
|
|
|
|
if value:find("FAIL") == nil then
|
|
|
|
value = args[4] .. util.sep() .. util.ltrim(value)
|
|
|
|
local p = extract_filepath(value)
|
|
|
|
|
|
|
|
if p then
|
|
|
|
|
|
|
|
value = package_path .. util.sep() .. util.ltrim(value)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
local p = extract_filepath(value)
|
|
|
|
local p = extract_filepath(value)
|
|
|
@ -218,6 +228,7 @@ function M.make(...)
|
|
|
|
changed = true
|
|
|
|
changed = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trace(value)
|
|
|
|
table.insert(lines, value)
|
|
|
|
table.insert(lines, value)
|
|
|
|
if itemn == 1 and failed and changed then
|
|
|
|
if itemn == 1 and failed and changed then
|
|
|
|
itemn = #lines
|
|
|
|
itemn = #lines
|
|
|
@ -252,6 +263,7 @@ function M.make(...)
|
|
|
|
if #lines > 0 then
|
|
|
|
if #lines > 0 then
|
|
|
|
vim.list_extend(errorlines, lines)
|
|
|
|
vim.list_extend(errorlines, lines)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trace(errorlines)
|
|
|
|
vim.fn.setqflist({}, " ", {
|
|
|
|
vim.fn.setqflist({}, " ", {
|
|
|
|
title = cmd,
|
|
|
|
title = cmd,
|
|
|
|
lines = errorlines,
|
|
|
|
lines = errorlines,
|
|
|
@ -261,6 +273,7 @@ function M.make(...)
|
|
|
|
log(errorlines[1], job_id)
|
|
|
|
log(errorlines[1], job_id)
|
|
|
|
vim.cmd([[echo v:shell_error]])
|
|
|
|
vim.cmd([[echo v:shell_error]])
|
|
|
|
elseif #lines > 0 then
|
|
|
|
elseif #lines > 0 then
|
|
|
|
|
|
|
|
trace(lines)
|
|
|
|
vim.fn.setqflist({}, " ", {
|
|
|
|
vim.fn.setqflist({}, " ", {
|
|
|
|
title = cmd,
|
|
|
|
title = cmd,
|
|
|
|
lines = lines,
|
|
|
|
lines = lines,
|
|
|
|