Skip to content

Commit

Permalink
Merge pull request #9 from ankitcharolia/feature/fix-bugs
Browse files Browse the repository at this point in the history
Feature/fix bugs
  • Loading branch information
ankitcharolia committed Aug 10, 2023
2 parents 2b51129 + fde31fd commit 0af7088
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ goenv is a command-line tool to manage multiple versions of Golang on your syste
## Installation
**Download**: https://github.com/ankitcharolia/goenv/releases
```shell
wget -O - https://github.com/ankitcharolia/goenv/releases/download/<VERSION>/goenv-linux-amd64.tar.gz | tar -xz -C ~/.go
wget -O - https://github.com/ankitcharolia/goenv/releases/latest/download/goenv-linux-amd64.tar.gz | tar -xz -C ~/.go
export PATH=$HOME/.go:$PATH >> ~/.bashrc
source ~/.bashrc
```
Expand Down
17 changes: 9 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,22 @@ func useGoVersion(version string) {
newPath := fmt.Sprintf("%s%c$PATH", binPath, os.PathListSeparator)
os.Setenv("PATH", newPath)

// ANSI escape code for red color
redColor := "\033[31m"
// ANSI escape code to reset color to default
resetColor := "\033[0m"

// Update the Go version in the appropriate shell configuration file
shell := getShell()
if shell == "bash" {
updateGoVersionInShellRC(version, ".bashrc")
message := fmt.Sprintf("Using Go version %s.%s\nPlease make sure to execute: source ~/.bashrc\n%s", version, redColor, resetColor)
fmt.Print(message)
} else if shell == "zsh" {
updateGoVersionInShellRC(version, ".zshrc")
message := fmt.Sprintf("Using Go version %s.%s\nPlease make sure to execute: source ~/.zshrc\n%s", version, redColor, resetColor)
fmt.Print(message)
}

// ANSI escape code for red color
redColor := "\033[31m"
// ANSI escape code to reset color to default
resetColor := "\033[0m"

message := fmt.Sprintf("Using Go version %s.%s\nPlease make sure to execute: source ~/.bashrc\n%s", version, redColor, resetColor)
fmt.Print(message)
}

// getShell returns the user's default shell
Expand Down

0 comments on commit 0af7088

Please sign in to comment.