Goenv: Difference between revisions
From charlesreid1
(Created page with "Goenv is like pyenv or rbenv but for Go <pre> git clone https://github.com/syndbg/goenv.git ~/.goenv </pre> Now add .goenv to your path in .bash_profile so goenv is a comman...") |
No edit summary |
||
| Line 17: | Line 17: | ||
export PATH="$GOENV_ROOT/bin:$PATH" | export PATH="$GOENV_ROOT/bin:$PATH" | ||
</pre> | </pre> | ||
Now log out and log back in. | |||
To prepare your path to use goenv's version of go, initialize it: | |||
<pre> | |||
eval "$(goenv init -)" | |||
</pre> | |||
List versions of go to install: | |||
<pre> | |||
goenv install -l | |||
</pre> | |||
Install version 1.7.5: | |||
<pre> | |||
goenv install 1.7.5 | |||
</pre> | |||
Switch the global version to this installed version: | |||
<pre> | |||
goenv global 1.7.5 | |||
</pre> | |||
You should see a version of go shimmed onto your path: | |||
<pre> | |||
$ which go | |||
/home/charles/.goenv/shims/go | |||
</pre> | |||
[[Category:Go]] | |||
[[Category:Goenv]] | |||
Latest revision as of 07:39, 15 February 2018
Goenv is like pyenv or rbenv but for Go
git clone https://github.com/syndbg/goenv.git ~/.goenv
Now add .goenv to your path in .bash_profile so goenv is a command
vim ~/.bash_profile
Add the lines:
export GOENV_ROOT="$HOME/.goenv" export PATH="$GOENV_ROOT/bin:$PATH"
Now log out and log back in.
To prepare your path to use goenv's version of go, initialize it:
eval "$(goenv init -)"
List versions of go to install:
goenv install -l
Install version 1.7.5:
goenv install 1.7.5
Switch the global version to this installed version:
goenv global 1.7.5
You should see a version of go shimmed onto your path:
$ which go /home/charles/.goenv/shims/go