From 93174986f885d5728a94fd6712320a6e40d21f20 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Tue, 23 Jul 2024 11:39:07 +0200 Subject: [PATCH] chore: improve checkhealth --- lua/neotest-golang/health.lua | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lua/neotest-golang/health.lua b/lua/neotest-golang/health.lua index d49aad72..03fa191f 100644 --- a/lua/neotest-golang/health.lua +++ b/lua/neotest-golang/health.lua @@ -10,23 +10,35 @@ local lib = require("neotest-golang.lib") local M = {} function M.check() - M.go_binary_on_path() + start("Requirements") + M.binary_found_on_path("go") M.go_mod_found() - M.is_plugin_available("neotest") M.is_plugin_available("nvim-treesitter") M.is_plugin_available("nio") - M.is_plugin_available("dap-go") M.is_plugin_available("plenary") + + start("DAP (optional)") + M.binary_found_on_path("dlv") + M.is_plugin_available("dap") + M.is_plugin_available("dapui") + M.is_plugin_available("dap-go") end -function M.go_binary_on_path() - local go = vim.fn.executable("go") - if go == 1 then - ok("Go binary found on PATH: " .. vim.fn.exepath("go")) +function M.binary_found_on_path(executable) + local found = vim.fn.executable(executable) + if found == 1 then + ok( + "Binary '" + .. executable + .. "' found on PATH: " + .. vim.fn.exepath(executable) + ) + return true else - warn("Go binary not found on PATH") + warn("Binary '" .. executable .. "' not found on PATH") end + return false end function M.go_mod_found()