refactor(installer): return function instead of M

This commit is contained in:
Smirnov Olexander 2022-06-17 22:32:41 +03:00
parent bc235b7cd3
commit 932c0aa0c3
2 changed files with 7 additions and 11 deletions

View file

@ -1,7 +1,7 @@
local tags = require "gopher.struct_tags"
local gopher = {}
gopher.install_deps = require("gopher.installer").install_all
gopher.install_deps = require "gopher.installer"
gopher.tags_add = tags.add
gopher.tags_rm = tags.remove
gopher.mod = require "gopher.gomod"

View file

@ -1,13 +1,11 @@
local Job = require "plenary.job"
local M = {
urls = {
gomodifytags = "github.com/fatih/gomodifytags",
impl = "github.com/josharian/impl",
},
local urls = {
gomodifytags = "github.com/fatih/gomodifytags",
impl = "github.com/josharian/impl",
}
local function install(pkg)
local url = M.urls[pkg] .. "@latest"
local url = urls[pkg] .. "@latest"
Job
:new({
@ -26,10 +24,8 @@ local function install(pkg)
end
---Install required go deps
function M.install_all()
for pkg, _ in pairs(M.urls) do
return function()
for pkg, _ in pairs(urls) do
install(pkg)
end
end
return M