fix: add go check to doctor
All checks were successful
Security Scan / security (push) Successful in 20s
All checks were successful
Security Scan / security (push) Successful in 20s
This commit is contained in:
parent
96aef54baf
commit
f13c3bf095
4 changed files with 34 additions and 0 deletions
|
|
@ -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"),
|
||||
|
|
|
|||
22
cmd/core/doctor/cmd_checks_test.go
Normal file
22
cmd/core/doctor/cmd_checks_test.go
Normal file
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -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" },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue