aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers/go.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/installers/go.lua')
-rw-r--r--lua/nvim-lsp-installer/installers/go.lua33
1 files changed, 19 insertions, 14 deletions
diff --git a/lua/nvim-lsp-installer/installers/go.lua b/lua/nvim-lsp-installer/installers/go.lua
index 61e29383..aa2eeaba 100644
--- a/lua/nvim-lsp-installer/installers/go.lua
+++ b/lua/nvim-lsp-installer/installers/go.lua
@@ -1,25 +1,30 @@
local path = require "nvim-lsp-installer.path"
+local std = require "nvim-lsp-installer.installers.std"
+local installers = require "nvim-lsp-installer.installers"
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,
- }
+ return installers.pipe {
+ std.ensure_executables { { "go", "go was not found in path, refer to https://golang.org/doc/install." } },
+ 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.run("go", vim.list_extend({ "get", "-v" }, packages))
+ c.run("go", { "clean", "-modcache" })
- c.spawn(callback)
- end
+ c.spawn(callback)
+ end,
+ }
end
function M.executable(root_dir, executable)