From f13c3bf0950c79089c428e8f78f9297f77476940 Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 04:17:35 +0000 Subject: [PATCH] fix: add go check to doctor --- cmd/core/doctor/cmd_checks.go | 7 +++++++ cmd/core/doctor/cmd_checks_test.go | 22 ++++++++++++++++++++++ cmd/core/doctor/cmd_install.go | 2 ++ pkg/cli/locales/en.json | 3 +++ 4 files changed, 34 insertions(+) create mode 100644 cmd/core/doctor/cmd_checks_test.go diff --git a/cmd/core/doctor/cmd_checks.go b/cmd/core/doctor/cmd_checks.go index 7b9047e..5b28259 100644 --- a/cmd/core/doctor/cmd_checks.go +++ b/cmd/core/doctor/cmd_checks.go @@ -26,6 +26,13 @@ func requiredChecks() []check { args: []string{"--version"}, versionFlag: "--version", }, + { + name: i18n.T("cmd.doctor.check.go.name"), + description: i18n.T("cmd.doctor.check.go.description"), + command: "go", + args: []string{"version"}, + versionFlag: "version", + }, { name: i18n.T("cmd.doctor.check.gh.name"), description: i18n.T("cmd.doctor.check.gh.description"), diff --git a/cmd/core/doctor/cmd_checks_test.go b/cmd/core/doctor/cmd_checks_test.go new file mode 100644 index 0000000..454fb01 --- /dev/null +++ b/cmd/core/doctor/cmd_checks_test.go @@ -0,0 +1,22 @@ +package doctor + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestRequiredChecksIncludesGo(t *testing.T) { + checks := requiredChecks() + + var found bool + for _, c := range checks { + if c.command == "go" { + found = true + assert.Equal(t, "version", c.versionFlag) + break + } + } + + assert.True(t, found, "required checks should include the Go compiler") +} diff --git a/cmd/core/doctor/cmd_install.go b/cmd/core/doctor/cmd_install.go index 4ffb59c..76d70ec 100644 --- a/cmd/core/doctor/cmd_install.go +++ b/cmd/core/doctor/cmd_install.go @@ -11,10 +11,12 @@ import ( func printInstallInstructions() { switch runtime.GOOS { case "darwin": + fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_macos_go")) fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_macos")) fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_macos_cask")) case "linux": fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_linux_header")) + fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_linux_go")) fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_linux_git")) fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_linux_gh")) fmt.Printf(" %s\n", i18n.T("cmd.doctor.install_linux_php")) diff --git a/pkg/cli/locales/en.json b/pkg/cli/locales/en.json index 26ef610..f64db04 100644 --- a/pkg/cli/locales/en.json +++ b/pkg/cli/locales/en.json @@ -12,7 +12,9 @@ "install_missing": "Install missing tools:", "install_macos": "brew install", "install_macos_cask": "brew install --cask", + "install_macos_go": "brew install go", "install_linux_header": "Install on Linux:", + "install_linux_go": "sudo apt install golang-go", "install_linux_git": "sudo apt install git", "install_linux_node": "curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt install -y nodejs", "install_linux_php": "sudo apt install php php-cli php-mbstring php-xml php-curl", @@ -30,6 +32,7 @@ "no_repos_yaml": "No repos.yaml found (run from workspace root)", "check": { "git": { "name": "Git", "description": "Version control" }, + "go": { "name": "Go", "description": "Go compiler" }, "docker": { "name": "Docker", "description": "Container runtime" }, "node": { "name": "Node.js", "description": "JavaScript runtime" }, "php": { "name": "PHP", "description": "PHP interpreter" },