Skip to content

Commit

Permalink
Revert "fix: added go_list_args option to configuration (#172)"
Browse files Browse the repository at this point in the history
This reverts commit a4d9968.
  • Loading branch information
fredrikaverpil committed Sep 5, 2024
1 parent ad62794 commit 698569f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
20 changes: 11 additions & 9 deletions lua/neotest-golang/lib/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lua/neotest-golang/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/options_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 698569f

Please sign in to comment.