MCPcopy Create free account
hub / github.com/Melkeydev/govm / UseVersion

Function UseVersion

internal/cli/cli.go:51–72  ·  view source on GitHub ↗
(version string)

Source from the content-addressed store, hash-verified

49 }
50}
51func UseVersion(version string) {
52 fmt.Printf("🔍 Looking for installed Go version matching %s...\n", version)
53 matchedVersion, err := findInstalledVersion(version)
54 if err != nil {
55 fmt.Printf("❌ %s\n", err)
56 return
57 }
58 fmt.Printf("🔄 Switching to Go %s...\n", matchedVersion.Version)
59 msg := utils.SwitchVersion(matchedVersion)()
60 switch msg := msg.(type) {
61 case utils.ErrMsg:
62 fmt.Printf("❌ Failed to switch version: %v\n", msg)
63 case utils.SwitchCompletedMsg:
64 fmt.Printf("✅ Switched to Go %s\n", matchedVersion.Version)
65 if !utils.IsShimInPath() {
66 fmt.Println("\n⚠️ GoVM is not in your PATH")
67 fmt.Println(utils.GetShimPathInstructions())
68 } else {
69 fmt.Println("🚀 Run 'go version' in a new terminal to verify")
70 }
71 }
72}
73func ListVersions() {
74 fmt.Println("📋 Installed Go Versions:")
75 homeDir, err := os.UserHomeDir()

Callers 1

handleCommandLineFunction · 0.92

Calls 4

SwitchVersionFunction · 0.92
IsShimInPathFunction · 0.92
GetShimPathInstructionsFunction · 0.92
findInstalledVersionFunction · 0.85

Tested by

no test coverage detected