We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
vim.system
1 parent 17278db commit d5fa4d4Copy full SHA for d5fa4d4
1 file changed
lua/gitlab/version.lua
@@ -1,14 +1,15 @@
1
local M = {}
2
3
M.is_go_valid = function()
4
- local go_version = io.popen("go version 2>&1"):read("*a")
5
- if go_version then
6
- local major, minor, _ = go_version:match("(%d+)%.(%d+)%.?(%d*)")
7
- if major and tonumber(major) >= 1 and tonumber(minor) >= 25 then
8
- return true
9
- else
10
- return false
11
- end
+ local has_go, go = pcall(vim.system, {"go", "version"});
+ if not has_go then
+ return false
+ end
+
+ local go_version = go:wait().stdout;
+ local major, minor, _ = go_version:match("(%d+)%.(%d+)%.?(%d*)")
+ if major and tonumber(major) >= 1 and tonumber(minor) >= 25 then
12
+ return true
13
else
14
return false
15
end
0 commit comments