all repos

gopher.nvim @ bfbee0f8257fcde1d994485ae16f3fd93ad17203

Minimalistic plugin for Go development

gopher.nvim/lua/gopher/health.lua(view raw)

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
30
31
32
33
34
35
36
37
local utils = require "gopher._utils"
local M = {
  _required = {
    plugins = {
      { lib = "plenary" },
      { lib = "nvim-treesitter" },
    },
    binarys = {
      { bin = "go", help = "required for GoMod, GoGet, GoGenerate command" },
      { bin = "gomodifytags", help = "required for modify struct tags" },
      { bin = "impl", help = "required for interface implementing" },
      { bin = "gotests", help = "required for test(s) generation" },
    },
  },
}

function M.check()
  vim.health.report_start "Required plugins"
  for _, plugin in ipairs(M._required.plugins) do
    if utils.lualib_is_found(plugin.lib) then
      vim.health.report_ok(plugin.lib .. " installed.")
    else
      vim.health.report_error(plugin.lib .. " not found. Gopher.nvim will not work without it!")
    end
  end

  vim.health.report_start "Required go tools"
  for _, binary in ipairs(M._required.binarys) do
    if utils.binary_is_found(binary.bin) then
      vim.health.report_ok(binary.bin .. " installed")
    else
      vim.health.report_warn(binary.bin .. " is not installed but " .. binary.help)
    end
  end
end

return M