Build tags deduplicate

gh_action
ray-x 3 months ago
parent cd698756e1
commit 3251ea1756

@ -79,7 +79,6 @@ M.get_build_tags = function(args, tbl)
end
local optarg, _, reminder = getopt.get_opts(args, short_opts, long_opts)
log('build tags', optarg, reminder)
if optarg['t'] then
table.insert(tags, optarg['t'])
end
@ -93,6 +92,8 @@ M.get_build_tags = function(args, tbl)
if _GO_NVIM_CFG.test_runner == 'dlv' then
t = '--build-flags'
end
log('build tags', tags, args, optarg, reminder)
if #tags > 0 then
if tbl then
return { t, table.concat(tags, ',') }, reminder, optarg
@ -423,7 +424,6 @@ M.get_testcase_name = function()
return nil
end
local function format_test_name(name)
name = name:gsub('"', '')
@ -456,7 +456,7 @@ local function run_tests_with_ts_node(args, func_node, tblcase_ns)
local test_name_path = format_test_name(func_node.name)
if tblcase_ns then
test_name_path = test_name_path .. "/" .. format_test_name(tblcase_ns)
test_name_path = test_name_path .. '/' .. format_test_name(tblcase_ns)
end
if func_node.name:find('Bench') then
@ -478,7 +478,7 @@ local function run_tests_with_ts_node(args, func_node, tblcase_ns)
end
if test_runner == 'dlv' then
local runflag = string.format("-test.run=%s", test_name_path)
local runflag = string.format('-test.run=%s', test_name_path)
table.insert(cmd, 3, fpath)
table.insert(cmd, '--')
table.insert(cmd, runflag)

@ -282,7 +282,6 @@ local function fs_write(path, data)
end)
end
local cache_dir = fn.stdpath('cache')
util.log = function(...)
if not _GO_NVIM_CFG or not _GO_NVIM_CFG.verbose then
@ -766,9 +765,11 @@ function util.get_build_tags(buf)
local t = vim.fn.substitute(line, pattern, [[\1]], '')
if t ~= line then -- tag found
t = vim.fn.substitute(t, [[ \+]], ',', 'g')
if not vim.tbl_contains(tags, t) then
table.insert(tags, t)
end
end
end
if #tags > 0 then
return tags
end

Loading…
Cancel
Save