tags in table
This commit is contained in:
parent
0ad9a0d370
commit
3c9c9c9abb
3 changed files with 17 additions and 2 deletions
|
|
@ -22,12 +22,16 @@ local default_config = {
|
||||||
},
|
},
|
||||||
---@class gopher.ConfigGotests
|
---@class gopher.ConfigGotests
|
||||||
gotests = {
|
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
|
-- gotests doesn't have template named "default" so this plugin uses "default" to set the default template
|
||||||
template = "default",
|
template = "default",
|
||||||
-- path to a directory containing custom test code templates
|
-- path to a directory containing custom test code templates
|
||||||
---@type string|nil
|
---@type string|nil
|
||||||
template_dir = nil,
|
template_dir = nil,
|
||||||
-- switch table tests from using slice to map (with test name for the key)
|
-- switch table tests from using slice to map (with test name for the key)
|
||||||
|
-- works only with gotests installed from develop branch
|
||||||
---@type boolean
|
---@type boolean
|
||||||
named = false,
|
named = false,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ local gotests = {}
|
||||||
|
|
||||||
---@param args table
|
---@param args table
|
||||||
local function add_test(args)
|
local function add_test(args)
|
||||||
if c.gotests.named ~= true then
|
if c.gotests.named then
|
||||||
table.insert(args, "-named")
|
table.insert(args, "-named")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
local c = require("gopher.config").commands
|
local c = require("gopher.config").commands
|
||||||
|
local c_gotests = require("gopher.config").gotests
|
||||||
local r = require "gopher._utils.runner"
|
local r = require "gopher._utils.runner"
|
||||||
local u = require "gopher._utils"
|
local u = require "gopher._utils"
|
||||||
local installer = {}
|
local installer = {}
|
||||||
|
|
@ -11,9 +12,19 @@ local urls = {
|
||||||
dlv = "github.com/go-delve/delve/cmd/dlv",
|
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
|
---@param pkg string
|
||||||
local function install(pkg)
|
local function install(pkg)
|
||||||
local url = urls[pkg] .. "@latest"
|
local url = urls[pkg] .. tags[pkg]
|
||||||
r.sync(c.go, {
|
r.sync(c.go, {
|
||||||
args = { "install", url },
|
args = { "install", url },
|
||||||
on_exit = function(data, status)
|
on_exit = function(data, status)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue