diff --git a/lua/gopher/config.lua b/lua/gopher/config.lua index 89af669..c717cf4 100644 --- a/lua/gopher/config.lua +++ b/lua/gopher/config.lua @@ -22,12 +22,16 @@ local default_config = { }, ---@class gopher.ConfigGotests gotests = { + -- gotests tag to install from + ---@type string + tag = "@latest", -- gotests doesn't have template named "default" so this plugin uses "default" to set the default template template = "default", -- path to a directory containing custom test code templates ---@type string|nil template_dir = nil, -- switch table tests from using slice to map (with test name for the key) + -- works only with gotests installed from develop branch ---@type boolean named = false, }, diff --git a/lua/gopher/gotests.lua b/lua/gopher/gotests.lua index 83b6847..0ef52cc 100644 --- a/lua/gopher/gotests.lua +++ b/lua/gopher/gotests.lua @@ -6,7 +6,7 @@ local gotests = {} ---@param args table local function add_test(args) - if c.gotests.named ~= true then + if c.gotests.named then table.insert(args, "-named") end diff --git a/lua/gopher/installer.lua b/lua/gopher/installer.lua index 2994b8a..5474f4a 100644 --- a/lua/gopher/installer.lua +++ b/lua/gopher/installer.lua @@ -1,4 +1,5 @@ local c = require("gopher.config").commands +local c_gotests = require("gopher.config").gotests local r = require "gopher._utils.runner" local u = require "gopher._utils" local installer = {} @@ -11,9 +12,19 @@ local urls = { dlv = "github.com/go-delve/delve/cmd/dlv", } +local latest_tag = "@latest" + +local tags = { + gomodifytags = latest_tag, + impl = latest_tag, + gotests = c_gotests.tag, + iferr = latest_tag, + dlv = latest_tag, +} + ---@param pkg string local function install(pkg) - local url = urls[pkg] .. "@latest" + local url = urls[pkg] .. tags[pkg] r.sync(c.go, { args = { "install", url }, on_exit = function(data, status)