diff --git a/lua/gopher/init.lua b/lua/gopher/init.lua index dff99ad..2f6f32e 100644 --- a/lua/gopher/init.lua +++ b/lua/gopher/init.lua @@ -4,7 +4,7 @@ local uc = require "gopher._utils.commands" local gopher = {} gopher.setup = require("gopher.config").setup -gopher.install_deps = require "gopher.installer" +gopher.install_deps = require("gopher.installer").install_deps gopher.impl = require("gopher.impl").impl gopher.iferr = require("gopher.iferr").iferr gopher.comment = require "gopher.comment" diff --git a/lua/gopher/installer.lua b/lua/gopher/installer.lua index fdd6242..cfe3e78 100644 --- a/lua/gopher/installer.lua +++ b/lua/gopher/installer.lua @@ -1,3 +1,8 @@ +local Job = require "plenary.job" +local c = require("gopher.config").commands +local u = require "gopher._utils" +local installer = {} + local urls = { gomodifytags = "github.com/fatih/gomodifytags", impl = "github.com/josharian/impl", @@ -8,13 +13,10 @@ local urls = { ---@param pkg string local function install(pkg) - local Job = require "plenary.job" - local u = require "gopher._utils" - local url = urls[pkg] .. "@latest" Job:new({ - command = "go", + command = c.go, args = { "install", url }, on_exit = function(_, retval) if retval ~= 0 then @@ -28,8 +30,10 @@ local function install(pkg) end ---Install required go deps -return function() +function installer.install_deps() for pkg, _ in pairs(urls) do install(pkg) end end + +return installer