store install tag in urls table

This commit is contained in:
Alex Malykh 2023-11-23 19:32:37 +04:00
parent 70c5938292
commit 9d5e8488c3

View file

@ -3,27 +3,19 @@ local r = require "gopher._utils.runner"
local u = require "gopher._utils" local u = require "gopher._utils"
local installer = {} local installer = {}
local latest = "@latest"
local urls = { local urls = {
gomodifytags = "github.com/fatih/gomodifytags", gomodifytags = { "github.com/fatih/gomodifytags", latest },
impl = "github.com/josharian/impl", impl = { "github.com/josharian/impl", latest },
gotests = "github.com/cweill/gotests/...", gotests = { "github.com/cweill/gotests/...", require("gopher.config").gotests.tag },
iferr = "github.com/koron/iferr", iferr = { "github.com/koron/iferr", latest },
dlv = "github.com/go-delve/delve/cmd/dlv", dlv = { "github.com/go-delve/delve/cmd/dlv", latest },
}
local latest_tag = "@latest"
local tags = {
gomodifytags = latest_tag,
impl = latest_tag,
gotests = require("gopher.config").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] .. tags[pkg] local url = urls[pkg][1] .. urls[pkg][2]
r.sync(c.go, { r.sync(c.go, {
args = { "install", url }, args = { "install", url },
on_exit = function(data, status) on_exit = function(data, status)