aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers/go.lua
blob: 61e29383f69674a571c5f3d57425f88ecae70ae5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local path = require "nvim-lsp-installer.path"
local process = require "nvim-lsp-installer.process"

local M = {}

function M.packages(packages)
    return function(server, callback, context)
        local c = process.chain {
            env = process.graft_env {
                GO111MODULE = "on",
                GOBIN = server.root_dir,
                GOPATH = server.root_dir,
            },
            cwd = server.root_dir,
            stdio_sink = context.stdio_sink,
        }

        c.run("go", vim.list_extend({ "get", "-v" }, packages))
        c.run("go", { "clean", "-modcache" })

        c.spawn(callback)
    end
end

function M.executable(root_dir, executable)
    return path.concat { root_dir, executable }
end

return M