From 698569fb2cb583bc8303cc22ac7d3f961da59efe Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Thu, 5 Sep 2024 06:39:37 +0200 Subject: [PATCH] Revert "fix: added go_list_args option to configuration (#172)" This reverts commit a4d99687c50259c25fa0e17d268ddbe2dad88abe. --- README.md | 1 - lua/neotest-golang/lib/cmd.lua | 20 +++++++++++--------- lua/neotest-golang/options.lua | 1 - tests/unit/options_spec.lua | 2 -- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7be6a982..07a06945 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,6 @@ consider setting up neotest and its adapters in a | Argument | Default value | Description | | ------------------------ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `go_test_args` | `{ "-v", "-race", "-count=1" }` | Arguments to pass into `go test`. | -| `go_list_args` | `{}` | Arguments to pass into `go list`. If using -tags in go_test_args the same argument should be passed to go_list_args for it to list tests properly. | | `dap_go_opts` | `{}` | Options to pass into `require("dap-go").setup()`. | | `testify_enabled` | `false` | Enable support for [testify](https://github.com/stretchr/testify) suites. See [here](https://github.com/fredrikaverpil/neotest-golang#testify-suites) for more info. | | `warn_test_name_dupes` | `true` | Warn about duplicate test names within the same Go package. | diff --git a/lua/neotest-golang/lib/cmd.lua b/lua/neotest-golang/lib/cmd.lua index d227c810..dd9eefaf 100644 --- a/lua/neotest-golang/lib/cmd.lua +++ b/lua/neotest-golang/lib/cmd.lua @@ -9,16 +9,18 @@ local json = require("neotest-golang.lib.json") local M = {} function M.golist_data(cwd) - -- call 'go list -json {go_list_args...} ./...' to get test file data - - -- combine base command, user args and packages(./...) - local cmd = { "go", "list", "-json" } - vim.list_extend(cmd, options.get().go_list_args or {}) - vim.list_extend(cmd, { "./..." }) - - local go_list_command_concat = table.concat(cmd, " ") + -- call 'go list -json ./...' to get test file data + local go_list_command = { + "go", + "list", + "-json", + "./...", + } + local go_list_command_concat = table.concat(go_list_command, " ") logger.debug("Running Go list: " .. go_list_command_concat .. " in " .. cwd) - local output = vim.system(cmd, { cwd = cwd, text = true }):wait().stdout or "" + local output = vim + .system(go_list_command, { cwd = cwd, text = true }) + :wait().stdout or "" if output == "" then logger.error({ "Execution of 'go list' failed, output:", output }) end diff --git a/lua/neotest-golang/options.lua b/lua/neotest-golang/options.lua index f94f87db..8482a765 100644 --- a/lua/neotest-golang/options.lua +++ b/lua/neotest-golang/options.lua @@ -8,7 +8,6 @@ local M = {} local opts = { go_test_args = { "-v", "-race", "-count=1" }, - go_list_args = {}, dap_go_opts = {}, testify_enabled = false, warn_test_name_dupes = true, diff --git a/tests/unit/options_spec.lua b/tests/unit/options_spec.lua index 8ba1441f..8b669990 100644 --- a/tests/unit/options_spec.lua +++ b/tests/unit/options_spec.lua @@ -9,7 +9,6 @@ describe("Options are set up", function() "-race", "-count=1", }, - go_list_args = {}, dap_go_opts = {}, testify_enabled = false, warn_test_name_dupes = true, @@ -32,7 +31,6 @@ describe("Options are set up", function() "-count=1", "-parallel=1", -- non-default }, - go_list_args = {}, dap_go_opts = {}, testify_enabled = false, warn_test_name_dupes = true,