feat: add "go mod" support

This commit is contained in:
Smirnov Olexander 2022-05-31 00:51:44 +03:00
parent 49d99135be
commit 807a0744a1
2 changed files with 20 additions and 0 deletions

19
lua/gopher/gomod.lua Normal file
View file

@ -0,0 +1,19 @@
local Job = require "plenary.job"
return function(...)
local args = { ... }
local cmd_args = vim.list_extend({ "mod" }, args)
Job
:new({
command = "go",
args = cmd_args,
on_exit = function(_, retval)
if retval ~= 0 then
print("command exited with code " .. retval)
return
end
end,
})
:sync()
end

View file

@ -4,5 +4,6 @@ local gopher = {}
gopher.install_deps = require("gopher.installer").install_all gopher.install_deps = require("gopher.installer").install_all
gopher.tags_add = tags.add gopher.tags_add = tags.add
gopher.tags_rm = tags.remove gopher.tags_rm = tags.remove
gopher.mod = require "gopher.gomod"
return gopher return gopher