[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

at b7ce5d1f35d28a1079f9426e493d4981e9fc2dd2 63 lines 1.8 kB view raw
1local health = {} 2local cmd = require("gopher.config").commands 3 4local deps = { 5 bin = { 6 { 7 bin = cmd.go, 8 msg = "required for `:GoGet`, `:GoMod`, `:GoGenerate`, `:GoWork`, `:GoInstallDeps`, `:GoInstallDepsSync`", 9 optional = false, 10 }, 11 { bin = cmd.gomodifytags, msg = "required for `:GoTagAdd`, `:GoTagRm`", optional = true }, 12 { bin = cmd.impl, msg = "required for `:GoImpl`", optional = true }, 13 { bin = cmd.iferr, msg = "required for `:GoIfErr`", optional = true }, 14 { 15 bin = cmd.gotests, 16 msg = "required for `:GoTestAdd`, `:GoTestsAll`, `:GoTestsExp`", 17 optional = true, 18 }, 19 }, 20 treesitter = { 21 { parser = "go", msg = "required for most of the parts of `gopher.nvim`" }, 22 }, 23} 24 25---@param bin string 26---@return boolean 27local function is_binary_found(bin) 28 return vim.fn.executable(bin) == 1 29end 30 31---@param ft string 32---@return boolean 33local function is_treesitter_parser_available(ft) 34 local ok, parser = pcall(vim.treesitter.get_parser, 0, ft) 35 return ok and parser ~= nil 36end 37 38function health.check() 39 vim.health.start "required binaries" 40 vim.health.info "all those binaries can be installed by `:GoInstallDeps`" 41 for _, bin in ipairs(deps.bin) do 42 if is_binary_found(bin.bin) then 43 vim.health.ok(bin.bin .. " installed") 44 else 45 if bin.optional then 46 vim.health.warn(bin.bin .. " not found, " .. bin.msg) 47 else 48 vim.health.error(bin.bin .. " not found, " .. bin.msg) 49 end 50 end 51 end 52 53 vim.health.start "required treesitter parsers" 54 for _, parser in ipairs(deps.treesitter) do 55 if is_treesitter_parser_available(parser.parser) then 56 vim.health.ok(parser.parser .. " parser installed") 57 else 58 vim.health.error(parser.parser .. " parser not found, " .. parser.msg) 59 end 60 end 61end 62 63return health