[mirror] Make your go dev experience better
github.com/olexsmir/gopher.nvim
neovim
golang
1local Job = require "plenary.job"
2local c = require("gopher.config").config.commands
3local u = require "gopher._utils"
4
5---run "go generate"
6return function(...)
7 local args = { ... }
8 if #args == 1 and args[1] == "%" then
9 args[1] = vim.fn.expand "%" ---@diagnostic disable-line: missing-parameter
10 end
11
12 local cmd_args = vim.list_extend({ "generate" }, args)
13
14 Job
15 :new({
16 command = c.go,
17 args = cmd_args,
18 on_exit = function(_, retval)
19 if retval ~= 0 then
20 u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error")
21 return
22 end
23
24 u.notify("go generate was success runned", "info")
25 end,
26 })
27 :start()
28end