syncable_cli/analyzer/tool_management/installers/
go.rs1use super::common::InstallationUtils;
2use crate::analyzer::tool_management::ToolDetector;
3use crate::error::Result;
4use log::{info, warn};
5use std::collections::HashMap;
6
7pub fn install_govulncheck(
9 tool_detector: &mut ToolDetector,
10 installed_tools: &mut HashMap<String, bool>,
11) -> Result<()> {
12 if tool_detector.detect_tool("govulncheck").available {
13 return Ok(());
14 }
15
16 info!("🔧 Installing govulncheck for Go vulnerability scanning...");
17
18 let success = InstallationUtils::execute_command(
19 "go",
20 &["install", "golang.org/x/vuln/cmd/govulncheck@latest"],
21 )?;
22
23 if success {
24 info!("✅ govulncheck installed successfully");
25 installed_tools.insert("govulncheck".to_string(), true);
26 tool_detector.clear_cache(); info!("💡 Note: Make sure ~/go/bin is in your PATH to use govulncheck");
28 } else {
29 warn!("❌ Failed to install govulncheck");
30 warn!("📦 Please install Go from https://golang.org/ first");
31 }
32
33 Ok(())
34}