aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers/go.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-09-16 15:54:30 +0200
committerGitHub <noreply@github.com>2021-09-16 15:54:30 +0200
commitd5400767fa44dc549a8fc6b1b1b1c7c233f9b341 (patch)
tree6cc37974c1f636187bbef5d44823a8f39f5040c2 /lua/nvim-lsp-installer/installers/go.lua
parentui/status-win: show relative install date next to installed servers (diff)
downloadmason-d5400767fa44dc549a8fc6b1b1b1c7c233f9b341.tar
mason-d5400767fa44dc549a8fc6b1b1b1c7c233f9b341.tar.gz
mason-d5400767fa44dc549a8fc6b1b1b1c7c233f9b341.tar.bz2
mason-d5400767fa44dc549a8fc6b1b1b1c7c233f9b341.tar.lz
mason-d5400767fa44dc549a8fc6b1b1b1c7c233f9b341.tar.xz
mason-d5400767fa44dc549a8fc6b1b1b1c7c233f9b341.tar.zst
mason-d5400767fa44dc549a8fc6b1b1b1c7c233f9b341.zip
better error messages (#92)
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)