diff --git a/lua/neotest-golang/cmd.lua b/lua/neotest-golang/cmd.lua index b0106e56..f3a9ed44 100644 --- a/lua/neotest-golang/cmd.lua +++ b/lua/neotest-golang/cmd.lua @@ -6,7 +6,7 @@ local options = require("neotest-golang.options") local M = {} -function M.golist_cmd(cwd) +function M.golist_cmd_results(cwd) -- call 'go list -json ./...' to get test file data local go_list_command = { "go", @@ -14,9 +14,9 @@ function M.golist_cmd(cwd) "-json", "./...", } - local go_list_command_result = + local cmd_results = vim.fn.system("cd " .. cwd .. " && " .. table.concat(go_list_command, " ")) - return go_list_command_result + return cmd_results end function M.fallback_to_go_test(executable) diff --git a/lua/neotest-golang/runspec_dir.lua b/lua/neotest-golang/runspec_dir.lua index 7e409ee6..a4552f6d 100644 --- a/lua/neotest-golang/runspec_dir.lua +++ b/lua/neotest-golang/runspec_dir.lua @@ -35,8 +35,8 @@ function M.build(pos) end local go_mod_folderpath = vim.fn.fnamemodify(go_mod_filepath, ":h") - local go_list_command = cmd.golist_cmd(go_mod_folderpath) - local golist_output = json.process_golist_output(go_list_command) + local go_list_results = cmd.golist_cmd_results(go_mod_folderpath) + local golist_output = json.process_golist_output(go_list_results) -- find the go module that corresponds to the go_mod_folderpath local module_name = "./..." -- if no go module, run all tests at the $CWD diff --git a/lua/neotest-golang/runspec_test.lua b/lua/neotest-golang/runspec_test.lua index cc189809..3660c2d8 100644 --- a/lua/neotest-golang/runspec_test.lua +++ b/lua/neotest-golang/runspec_test.lua @@ -15,8 +15,8 @@ local M = {} function M.build(pos, strategy) --- @type string local test_folder_absolute_path = string.match(pos.path, "(.+)/") - local go_list_command = cmd.golist_cmd(test_folder_absolute_path) - local golist_output = json.process_golist_output(go_list_command) + local go_list_results = cmd.golist_cmd_results(test_folder_absolute_path) + local golist_output = json.process_golist_output(go_list_results) --- @type string local test_name = convert.to_gotest_test_name(pos.id)