style: reformat all lua code
This commit is contained in:
parent
4fee3543e0
commit
4b83da6d7f
8 changed files with 84 additions and 102 deletions
|
|
@ -11,8 +11,7 @@ return function(...)
|
|||
|
||||
local cmd_args = vim.list_extend({ "generate" }, args)
|
||||
|
||||
Job
|
||||
:new({
|
||||
Job:new({
|
||||
command = c.go,
|
||||
args = cmd_args,
|
||||
on_exit = function(_, retval)
|
||||
|
|
@ -23,6 +22,5 @@ return function(...)
|
|||
|
||||
u.notify("go generate was success runned", "info")
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
}):start()
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ return function(...)
|
|||
|
||||
local cmd_args = vim.list_extend({ "get" }, args)
|
||||
|
||||
Job
|
||||
:new({
|
||||
Job:new({
|
||||
command = c.go,
|
||||
args = cmd_args,
|
||||
on_exit = function(_, retval)
|
||||
|
|
@ -30,6 +29,5 @@ return function(...)
|
|||
|
||||
u.notify("go get was success runned", "info")
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
}):start()
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ return function(...)
|
|||
|
||||
local cmd_args = vim.list_extend({ "mod" }, args)
|
||||
|
||||
Job
|
||||
:new({
|
||||
Job:new({
|
||||
command = c.go,
|
||||
args = cmd_args,
|
||||
on_exit = function(_, retval)
|
||||
|
|
@ -24,6 +23,5 @@ return function(...)
|
|||
|
||||
u.notify("go mod was success runned", "info")
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
}):start()
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ local M = {}
|
|||
|
||||
---@param cmd_args table
|
||||
local function run(cmd_args)
|
||||
Job
|
||||
:new({
|
||||
Job:new({
|
||||
command = c.gotests,
|
||||
args = cmd_args,
|
||||
on_exit = function(_, retval)
|
||||
|
|
@ -18,8 +17,7 @@ local function run(cmd_args)
|
|||
|
||||
u.notify("unit test(s) generated", "info")
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
}):start()
|
||||
end
|
||||
|
||||
---@param args table
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ return function(...)
|
|||
}
|
||||
|
||||
local res_data
|
||||
Job
|
||||
:new({
|
||||
Job:new({
|
||||
command = c.impl,
|
||||
args = cmd_args,
|
||||
on_exit = function(data, retval)
|
||||
|
|
@ -66,8 +65,7 @@ return function(...)
|
|||
|
||||
res_data = data:result()
|
||||
end,
|
||||
})
|
||||
:sync()
|
||||
}):sync()
|
||||
|
||||
local pos = vim.fn.getcurpos()[2]
|
||||
table.insert(res_data, 1, "")
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ local urls = {
|
|||
local function install(pkg)
|
||||
local url = urls[pkg] .. "@latest"
|
||||
|
||||
Job
|
||||
:new({
|
||||
Job:new({
|
||||
command = "go",
|
||||
args = { "install", url },
|
||||
on_exit = function(_, retval)
|
||||
|
|
@ -22,8 +21,7 @@ local function install(pkg)
|
|||
|
||||
u.notify("install " .. url .. " finished", "info ")
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
}):start()
|
||||
end
|
||||
|
||||
---Install required go deps
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@ local function modify(...)
|
|||
|
||||
-- get result of "gomodifytags" works
|
||||
local res_data
|
||||
Job
|
||||
:new({
|
||||
Job:new({
|
||||
command = c.gomodifytags,
|
||||
args = cmd_args,
|
||||
on_exit = function(data, retval)
|
||||
|
|
@ -56,8 +55,7 @@ local function modify(...)
|
|||
|
||||
res_data = data:result()
|
||||
end,
|
||||
})
|
||||
:sync()
|
||||
}):sync()
|
||||
|
||||
-- decode goted value
|
||||
local tagged = vim.json.decode(table.concat(res_data))
|
||||
|
|
|
|||
|
|
@ -9,10 +9,8 @@ describe("gopher.struct_tags", function()
|
|||
local add = require("gopher.struct_tags").add
|
||||
local name = vim.fn.tempname() .. ".go"
|
||||
local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_input.go")
|
||||
local output_file = vim.fn.join(
|
||||
vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_output.go"),
|
||||
"\n"
|
||||
)
|
||||
local output_file =
|
||||
vim.fn.join(vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_output.go"), "\n")
|
||||
|
||||
vim.fn.writefile(input_file, name)
|
||||
vim.cmd("silent exe 'e " .. name .. "'")
|
||||
|
|
@ -33,10 +31,8 @@ describe("gopher.struct_tags", function()
|
|||
local remove = require("gopher.struct_tags").remove
|
||||
local name = vim.fn.tempname() .. ".go"
|
||||
local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_input.go")
|
||||
local output_file = vim.fn.join(
|
||||
vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_output.go"),
|
||||
"\n"
|
||||
)
|
||||
local output_file =
|
||||
vim.fn.join(vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_output.go"), "\n")
|
||||
|
||||
vim.fn.writefile(input_file, name)
|
||||
vim.cmd("silent exe 'e " .. name .. "'")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue