-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathversion.lua
More file actions
29 lines (24 loc) · 798 Bytes
/
Copy pathversion.lua
File metadata and controls
29 lines (24 loc) · 798 Bytes
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 M = {}
local minimum_go_version = "1.25.1"
---Return true if Go is available and its version is supported by the plugin.
---@return boolean
M.is_go_valid = function()
local has_go, go = pcall(vim.system, { "go", "version" })
if not has_go then
return false
end
local go_version = vim.version.parse(go:wait().stdout, { strict = false })
return go_version ~= nil and vim.version.ge(go_version, minimum_go_version)
end
---Return error if the Go version is not valid.
---@return string?
M.check_go_version = function()
local has_version = M.is_go_valid()
if not has_version then
return string.format(
"Go is not installed, or version is older than %s. Please reinstall up-to-date Go version: https://go.dev/dl/",
minimum_go_version
)
end
end
return M