[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

refactor(installer): return function instead of M

Changed files
+7 -11
lua
+1 -1
lua/gopher/init.lua
··· 1 1 local tags = require "gopher.struct_tags" 2 2 local gopher = {} 3 3 4 - gopher.install_deps = require("gopher.installer").install_all 4 + gopher.install_deps = require "gopher.installer" 5 5 gopher.tags_add = tags.add 6 6 gopher.tags_rm = tags.remove 7 7 gopher.mod = require "gopher.gomod"
+6 -10
lua/gopher/installer.lua
··· 1 1 local Job = require "plenary.job" 2 - local M = { 3 - urls = { 4 - gomodifytags = "github.com/fatih/gomodifytags", 5 - impl = "github.com/josharian/impl", 6 - }, 2 + local urls = { 3 + gomodifytags = "github.com/fatih/gomodifytags", 4 + impl = "github.com/josharian/impl", 7 5 } 8 6 9 7 local function install(pkg) 10 - local url = M.urls[pkg] .. "@latest" 8 + local url = urls[pkg] .. "@latest" 11 9 12 10 Job 13 11 :new({ ··· 26 24 end 27 25 28 26 ---Install required go deps 29 - function M.install_all() 30 - for pkg, _ in pairs(M.urls) do 27 + return function() 28 + for pkg, _ in pairs(urls) do 31 29 install(pkg) 32 30 end 33 31 end 34 - 35 - return M