Skip to content

Commit 30eab56

Browse files
Don't suggest adding GOROOT/bin and GOPATH/bin to the PATH. (#463)
The installation instructions say to make the shell init script execute the output of `goenv init -`. That output contains this among other things: ``` export PATH="${GOENV_ROOT}/shims:${PATH}" ``` The main point of that line is to make the `go` command resolve to `$GOENV_ROOT/shims/go` such that `goenv` has control over the default `go`. The installation instructions later say to add this after the eval in order to let "goenv manage GOPATH and GOROOT": ``` export PATH="$GOROOT/bin:$PATH" export PATH="$PATH:$GOPATH/bin" ``` This effectively overrides the first line as `$GOROOT/bin` is also expected to contain a `go` binary. However that binary is not controlled by `goenv`. Furthermore AFAICT these two lines do not make "goenv manage GOPATH and GOROOT". This has confused at least [one other user](#186 (comment)). This change removes the section about GOROOT and GOPATH as I don't see why it would belong in the goenv installation instructions.
1 parent db10fc4 commit 30eab56

1 file changed

Lines changed: 3 additions & 26 deletions

File tree

INSTALL.md

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,20 @@ easy to fork and contribute any changes back upstream.
3737
may observe strange behaviour, such as `goenv` getting into an infinite loop.
3838
See pyenv's issue [#264](https://github.com/pyenv/pyenv/issues/264) for details.
3939

40-
4. **If you want `goenv` to manage `GOPATH` and `GOROOT` (recommended)**,
41-
add `GOPATH` and `GOROOT` to your shell **after `eval "$(goenv init -)"`**.
42-
43-
echo 'export PATH="$GOROOT/bin:$PATH"' >> ~/.bash_profile
44-
echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.bash_profile
45-
46-
**Zsh note**: Modify your `~/.zshenv` or `~/.zshrc` file instead of `~/.bash_profile`.
47-
48-
**Ubuntu note**: Modify your `~/.bashrc` file instead of `~/.bash_profile`.
49-
50-
**General warning**: There are some systems where the `BASH_ENV` variable is configured
51-
to point to `.bashrc`. On such systems you should almost certainly put the abovementioned line
52-
`eval "$(goenv init -)` into `.bash_profile`, and **not** into `.bashrc`. Otherwise you
53-
may observe strange behaviour, such as `goenv` getting into an infinite loop.
54-
See pyenv's issue [#264](https://github.com/pyenv/pyenv/issues/264) for details.
55-
56-
**Security warning**: You likely want to keep $GOPATH/bin at the end
57-
of your $PATH as shown above, rather than at the beginning. See
58-
[#99](https://github.com/go-nv/goenv/issues/99) for details and
59-
discussion.
60-
6140

62-
5. **Restart your shell so the path changes take effect.**
41+
4. **Restart your shell so the path changes take effect.**
6342
You can now begin using goenv.
6443

6544
exec $SHELL
6645

67-
6. **Install Go versions into `$GOENV_ROOT/versions`.**
46+
5. **Install Go versions into `$GOENV_ROOT/versions`.**
6847
For example, to download and install Go 1.12.0, run:
6948

7049
goenv install 1.12.0
7150

7251
**NOTE:** It downloads and places the prebuilt Go binaries provided by Google.
7352

74-
7. **Set goenv global version.**
53+
6. **Set goenv global version.**
7554
For example, to set the version to Go 1.12.0, run:
7655

7756
goenv global 1.12.0
@@ -82,8 +61,6 @@ An example `.zshrc` that is properly configured may look like
8261
export GOENV_ROOT="$HOME/.goenv"
8362
export PATH="$GOENV_ROOT/bin:$PATH"
8463
eval "$(goenv init -)"
85-
export PATH="$GOROOT/bin:$PATH"
86-
export PATH="$PATH:$GOPATH/bin"
8764
```
8865

8966
## via ZPlug plugin manager for Zsh

0 commit comments

Comments
 (0)