Last active
December 2, 2022 19:51
-
-
Save lggomez/ba8ac4ac4100f6affd3903819c00118f to your computer and use it in GitHub Desktop.
Easy setup to switch between go versions (1.11+) with gvm - go version manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| echo $BASH_VERSION | |
| # GVM readme: https://github.com/e-nikolov/gvm/blob/master/README.md | |
| bash < <(curl -s -S -L https://raw.githubusercontent.com/e-nikolov/gvm/master/binscripts/gvm-installer) | |
| source $HOME/.gvm/scripts/gvm | |
| # To view available versions to install run 'gvm listall' later on | |
| # Older versions you'll probably not need | |
| gvm install go1.11.13 --prefer-binary | |
| gvm install go1.12.13 --prefer-binary | |
| gvm install go1.13.10 --prefer-binary | |
| gvm install go1.14.1 --prefer-binary | |
| echo '' >>~/.bash_profile | |
| echo '# GO version manager' >>~/.bash_profile | |
| echo '[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"' >>~/.bash_profile | |
| #select latest as default upon session init | |
| echo 'gvm use go1.14.1 --default' >>~/.bash_profile | |
| #select latest default after completion | |
| gvm use 1.14.1 --default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment