aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorSimon Gate <simon@kampgate.se>2022-01-21 19:52:52 +0100
committerGitHub <noreply@github.com>2022-01-21 19:52:52 +0100
commitff68cb51ede8ddcfcd9b99e0467af13953ad74f8 (patch)
tree449b69c7078aee12f8ff9f69d48703f6e4fd6c45 /lua
parentrun autogen_metadata.lua (diff)
downloadmason-ff68cb51ede8ddcfcd9b99e0467af13953ad74f8.tar
mason-ff68cb51ede8ddcfcd9b99e0467af13953ad74f8.tar.gz
mason-ff68cb51ede8ddcfcd9b99e0467af13953ad74f8.tar.bz2
mason-ff68cb51ede8ddcfcd9b99e0467af13953ad74f8.tar.lz
mason-ff68cb51ede8ddcfcd9b99e0467af13953ad74f8.tar.xz
mason-ff68cb51ede8ddcfcd9b99e0467af13953ad74f8.tar.zst
mason-ff68cb51ede8ddcfcd9b99e0467af13953ad74f8.zip
Change go installer from get to install (#438)
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/installers/go.lua20
-rw-r--r--lua/nvim-lsp-installer/servers/arduino_language_server/init.lua2
-rw-r--r--lua/nvim-lsp-installer/servers/efm/init.lua2
-rw-r--r--lua/nvim-lsp-installer/servers/gopls/init.lua2
-rw-r--r--lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua2
-rw-r--r--lua/nvim-lsp-installer/servers/sqls/init.lua2
6 files changed, 11 insertions, 19 deletions
diff --git a/lua/nvim-lsp-installer/installers/go.lua b/lua/nvim-lsp-installer/installers/go.lua
index a3b21176..608520a0 100644
--- a/lua/nvim-lsp-installer/installers/go.lua
+++ b/lua/nvim-lsp-installer/installers/go.lua
@@ -1,17 +1,15 @@
local std = require "nvim-lsp-installer.installers.std"
local installers = require "nvim-lsp-installer.installers"
-local Data = require "nvim-lsp-installer.data"
local process = require "nvim-lsp-installer.process"
local M = {}
----@param packages string[] @The Go packages to install. The first item in this list will be the recipient of the server version, should the user request a specific one.
-function M.packages(packages)
+---@param package string The Go package to install.
+function M.package(package)
return installers.pipe {
std.ensure_executables { { "go", "go was not found in path, refer to https://golang.org/doc/install." } },
---@type ServerInstallerFunction
function(_, callback, ctx)
- local pkgs = Data.list_copy(packages or {})
local c = process.chain {
env = process.graft_env {
GO111MODULE = "on",
@@ -22,18 +20,12 @@ function M.packages(packages)
stdio_sink = ctx.stdio_sink,
}
- ctx.receipt:with_primary_source(ctx.receipt.go(pkgs[1]))
- for i = 2, #pkgs do
- ctx.receipt:with_secondary_source(ctx.receipt.go(pkgs[i]))
- end
+ ctx.receipt:with_primary_source(ctx.receipt.go(package))
- if ctx.requested_server_version then
- -- The "head" package is the recipient for the requested version. It's.. by design... don't ask.
- pkgs[1] = ("%s@%s"):format(pkgs[1], ctx.requested_server_version)
- end
+ local version = ctx.requested_server_version or "latest"
+ local pkg = ("%s@%s"):format(package, version)
- c.run("go", vim.list_extend({ "get", "-v" }, pkgs))
- c.run("go", { "clean", "-modcache" })
+ c.run("go", { "install", "-v", pkg })
c.spawn(callback)
end,
diff --git a/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua b/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua
index 49da467a..f075ef0c 100644
--- a/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua
+++ b/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua
@@ -63,7 +63,7 @@ return function(name, root_dir)
local arduino_language_server_installer = installers.branch_context {
context.set_working_dir "arduino-language-server",
- go.packages { "github.com/arduino/arduino-language-server" },
+ go.package "github.com/arduino/arduino-language-server",
}
local clangd_installer = installers.branch_context {
diff --git a/lua/nvim-lsp-installer/servers/efm/init.lua b/lua/nvim-lsp-installer/servers/efm/init.lua
index c665df7a..415c6d92 100644
--- a/lua/nvim-lsp-installer/servers/efm/init.lua
+++ b/lua/nvim-lsp-installer/servers/efm/init.lua
@@ -7,7 +7,7 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/mattn/efm-langserver",
languages = {},
- installer = go.packages { "github.com/mattn/efm-langserver" },
+ installer = go.package "github.com/mattn/efm-langserver",
default_options = {
cmd_env = go.env(root_dir),
},
diff --git a/lua/nvim-lsp-installer/servers/gopls/init.lua b/lua/nvim-lsp-installer/servers/gopls/init.lua
index 9b1f8c09..a8914156 100644
--- a/lua/nvim-lsp-installer/servers/gopls/init.lua
+++ b/lua/nvim-lsp-installer/servers/gopls/init.lua
@@ -7,7 +7,7 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://pkg.go.dev/golang.org/x/tools/gopls",
languages = { "go" },
- installer = go.packages { "golang.org/x/tools/gopls" },
+ installer = go.package "golang.org/x/tools/gopls",
default_options = {
cmd_env = go.env(root_dir),
},
diff --git a/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua b/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua
index 6ac0f995..b9c20d42 100644
--- a/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua
@@ -7,7 +7,7 @@ return function(name, root_dir)
name = name,
root_dir = root_dir,
homepage = "https://github.com/jdbaldry/jsonnet-language-server",
- installer = go.packages { "github.com/jdbaldry/jsonnet-language-server" },
+ installer = go.package "github.com/jdbaldry/jsonnet-language-server",
default_options = {
-- TODO: use env instead of cmd once https://github.com/neovim/nvim-lspconfig/pull/1559 is merged
cmd = { path.concat { root_dir, "jsonnet-language-server" } },
diff --git a/lua/nvim-lsp-installer/servers/sqls/init.lua b/lua/nvim-lsp-installer/servers/sqls/init.lua
index 40a11d67..4e508eb1 100644
--- a/lua/nvim-lsp-installer/servers/sqls/init.lua
+++ b/lua/nvim-lsp-installer/servers/sqls/init.lua
@@ -7,7 +7,7 @@ return function(name, root_dir)
root_dir = root_dir,
languages = { "sql" },
homepage = "https://github.com/lighttiger2505/sqls",
- installer = go.packages { "github.com/lighttiger2505/sqls" },
+ installer = go.package "github.com/lighttiger2505/sqls",
default_options = {
cmd_env = go.env(root_dir),
},