tags in table

This commit is contained in:
Alex Malykh 2023-11-23 18:27:56 +04:00
parent 0ad9a0d370
commit 3c9c9c9abb
3 changed files with 17 additions and 2 deletions

View file

@ -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,
},

View file

@ -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

View file

@ -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)