diff options
Diffstat (limited to 'lua/nvim-lsp-installer/installers/go.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/go.lua | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lua/nvim-lsp-installer/installers/go.lua b/lua/nvim-lsp-installer/installers/go.lua index d7857498..bfa7bc54 100644 --- a/lua/nvim-lsp-installer/installers/go.lua +++ b/lua/nvim-lsp-installer/installers/go.lua @@ -4,8 +4,8 @@ local process = require "nvim-lsp-installer.process" local M = {} ----@param package string The Go package to install. -function M.package(package) +---@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) return installers.pipe { std.ensure_executables { { "go", "go was not found in path, refer to https://golang.org/doc/install." } }, ---@type ServerInstallerFunction @@ -18,12 +18,20 @@ function M.package(package) stdio_sink = ctx.stdio_sink, } - ctx.receipt:with_primary_source(ctx.receipt.go(package)) + -- Install the head package + do + local head_package = packages[1] + ctx.receipt:with_primary_source(ctx.receipt.go(head_package)) + local version = ctx.requested_server_version or "latest" + c.run("go", { "install", "-v", ("%s@%s"):format(head_package, version) }) + end - local version = ctx.requested_server_version or "latest" - local pkg = ("%s@%s"):format(package, version) - - c.run("go", { "install", "-v", pkg }) + -- Install secondary packages + for i = 2, #packages do + local package = packages[i] + ctx.receipt:with_secondary_source(ctx.receipt.go(package)) + c.run("go", { "install", "-v", ("%s@latest"):format(package) }) + end c.spawn(callback) end, |
