feat: add GoGenerate command

feat(health): add gogenerate

docs(gogenerate): add doc
This commit is contained in:
Smirnov Olexander 2022-06-21 14:23:37 +03:00
parent 572c346098
commit 507ccb6347
5 changed files with 40 additions and 1 deletions

25
lua/gopher/gogenerate.lua Normal file
View file

@ -0,0 +1,25 @@
local Job = require "plenary.job"
return function(...)
local args = { ... }
if #args == 1 and args[1] == "%" then
args[1] = vim.fn.expand "%" ---@diagnostic disable-line: missing-parameter
end
local cmd_args = vim.list_extend({ "generate" }, args)
Job
:new({
command = "go",
args = cmd_args,
on_exit = function(_, retval)
if retval ~= 0 then
print("command exited with code " .. retval)
return
else
print "command runs successfully"
end
end,
})
:start()
end