From d5e2b8cdd84afdb0c49c42a6e8972acc645e0283 Mon Sep 17 00:00:00 2001 From: ray-x Date: Tue, 30 Apr 2024 21:45:58 +1000 Subject: [PATCH] retiring richgo, use gotestsum instead --- lua/go.lua | 12 +++++++----- lua/go/gotest.lua | 13 ------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/lua/go.lua b/lua/go.lua index 770b909..2c00803 100644 --- a/lua/go.lua +++ b/lua/go.lua @@ -276,11 +276,13 @@ end go.set_test_runner = function(runner) -- richgo, go test, richgo, dlv, ginkgo local runners = { 'richgo', 'go', 'richgo', 'ginkgo' } -- dlv - for _, v in pairs(runners) do - if v == runner then - _GO_NVIM_CFG.test_runner = runner - return - end + if runner == 'richgo' then + vim.notify('richgo is deprecated, use gotestsum', vim.log.levels.WARN) + runner = 'gotestsum' + end + if vim.tbl_contains(runners, runner) then + _GO_NVIM_CFG.test_runner = runner + return end vim.notify('runner not supported ' .. runner, vim.log.levels.ERROR) end diff --git a/lua/go/gotest.lua b/lua/go/gotest.lua index 761a382..e45257c 100644 --- a/lua/go/gotest.lua +++ b/lua/go/gotest.lua @@ -110,13 +110,6 @@ function M.get_test_path() return '.' .. sep .. relative_path end -local function richgo(cmd) - if cmd[1] == 'go' and vfn.executable('richgo') == 1 then - cmd[1] = 'richgo' - end - return cmd -end - local function get_test_filebufnr() local fn = vfn.expand('%') trace(fn) @@ -271,9 +264,7 @@ local function run_test(path, args) log(cmd, args) local run_in_floaterm = _GO_NVIM_CFG.run_in_floaterm or optarg['F'] if run_in_floaterm then - install('richgo') local term = require('go.term').run - cmd = richgo(cmd) log(cmd) term({ cmd = cmd, autoclose = false }) return cmd @@ -489,9 +480,7 @@ local function run_tests_with_ts_node(args, func_node, tblcase_ns) if run_in_floaterm then utils.log(cmd) - install('richgo') local term = require('go.term').run - cmd = richgo(cmd) term({ cmd = cmd, autoclose = false }) return end @@ -648,9 +637,7 @@ M.test_file = function(...) table.insert(cmd_args, tests) -- shell script | is a pipe if optarg['F'] or _GO_NVIM_CFG.run_in_floaterm then - install('richgo') local term = require('go.term').run - cmd_args = richgo(cmd_args) local cmd_args_str = table.concat(cmd_args, ' ') log(cmd_args) term({ cmd = cmd_args_str, autoclose = false })