goenv: go get binaries: command not found
Okay so, I’m new to Go, and found goenv since I’m familiar with rbenv, pyenv, etc.
I’m having trouble getting stuff installed with go get commands that have binaries to actually ever say anything other than “command not found”.
Forgive me if this has already been discussed, I did browse the closed issues and the open issues but couldn’t find exactly this.
I’m assuming this works a lot like rbenv, etc.
I use goenv as I would any other.
goenv install 1.8.3
goenv global 1.8.3
I install dependencies such as revel and dep with:
go get -u github.com/golang/dep/cmd/dep
go get github.com/revel/revel
goenv rehash and I still am getting:
-bash: dep: command not found
-bash: revel: command not found
In my ~/.bash_profile on MacOS Sierra:
export GOENV_ROOT="$HOME/.goenv"
export PATH="$GOENV_ROOT/bin:$PATH"
eval "$(goenv init -)"
export GOPATH="$HOME/go"
As seen above, I even tried something from another closed issue for setting GOPATH= to ~/go as default. But no dice.
Any tips on this?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 21 (7 by maintainers)
Commits related to this issue
- [GH-30] Add automatic management of env `GO{PATH,ROOT}` Example usage with default settings for `goenv`: ``` > goenv install 1.12.0 ... > echo $GOROOT /home/syndbg/.goenv/versions/1.12.0 > echo $GO... — committed to go-nv/goenv by syndbg 5 years ago
- [GH-30] Add automatic management of env `GO{PATH,ROOT}` Example usage with default settings for `goenv`: ``` > goenv install 1.12.0 ... > echo $GOROOT /home/syndbg/.goenv/versions/1.12.0 > echo $GO... — committed to go-nv/goenv by syndbg 5 years ago
- [GH-30] Add automatic management of env `GO{PATH,ROOT}` Example usage with default settings for `goenv`: ``` > goenv install 1.12.0 ... > echo $GOROOT /home/syndbg/.goenv/versions/1.12.0 > echo $GO... — committed to go-nv/goenv by syndbg 5 years ago
- [GH-30][GH-50] Add automatic management of env `GO{PATH,ROOT}` Example usage with default settings for `goenv`: ``` > goenv install 1.12.0 ... > echo $GOROOT /home/syndbg/.goenv/versions/1.12.0 > e... — committed to go-nv/goenv by syndbg 5 years ago
- [GH-30][GH-50] Add automatic management of env `GO{PATH,ROOT}` Example usage with default settings for `goenv`: ``` > goenv install 1.12.0 ... > echo $GOROOT /home/syndbg/.goenv/versions/1.12.0 > e... — committed to go-nv/goenv by syndbg 5 years ago
- [GH-30][GH-50] Add automatic management of env `GO{PATH,ROOT}` Example usage with default settings for `goenv`: ``` > goenv install 1.12.0 ... > echo $GOROOT /home/syndbg/.goenv/versions/1.12.0 > e... — committed to go-nv/goenv by syndbg 5 years ago
- Merge pull request #70 from syndbg/gh-30-improve-gopath [GH-30][GH-50] Improve GOPATH and GOROOT env var management — committed to go-nv/goenv by syndbg 5 years ago
- [GH-30][GH-50] Add `goenv-exec` CHANGELOG entry — committed to go-nv/goenv by syndbg 5 years ago
- automatic shims https://github.com/syndbg/goenv/issues/30 Thanks for https://github.com/kadaan https://github.com/syndbg/goenv/issues/30#issuecomment-560240354 https://github.com/kadaan/goenv-goget-... — committed to yssource/goenv by yssource 4 years ago
- automatic shims (#119) https://github.com/syndbg/goenv/issues/30 Thanks for https://github.com/kadaan https://github.com/syndbg/goenv/issues/30#issuecomment-560240354 https://github.com/kadaan/g... — committed to go-nv/goenv by yssource 4 years ago
- set used path by goenv https://github.com/syndbg/goenv/issues/30 — committed to teitei-tk/dotfiles by teitei-tk 4 years ago
- Fix GitHub Actions (#254) * add 1.14.1 and 1.13.9 (#116) * :tada: add 1.14.1 * :tada: add 1.13.9 * :green_heart: Fix order * add 1.14.2 and 1.13.10 (#120) * Add ZPlug installation inst... — committed to go-nv/goenv by ChronosMasterOfAllTime 2 years ago
Once I added these lines, it seems to have helped.
But I’m not sure that should be required if
goenvworks and manages these things but I’ll roll with it for now.@joshuairl (or anyone else who has the same issue), try the following:
now run
go envto check if your env is set up properly.Isn’t the usual method of these *env tools to write a shim when installing a new package, shim that will itself run the right version of the package’s binary/script?
Then, when executed, the shim searches for the actual binary and execute it. It may also check what is the current version, if the real executable is available for this version, or other logic things, and display useful messages.
I currently have to do the following to make it partially work:
…but now my PATH is fixed to the first global version I defined. If I change the global order, of I have a different local version defined, my PATH won’t be updated and the executables won’t be found. I’ll have to manually update my PATH each time I change version.
@syndbg I tried it, but I still don’t understand. I have the following in my
.bash_profile:And indeed, if I install a tool, e.g.
gbI can now use it from the command line. This part is ok.However, I noticed that now the version of
gowhich is used always sticks to the path set in~/.goenv/version.Consider the following:
I’m in
$HOME:–> OK
However, say I’m in a project using
1.12.1:–> NOK
I think dynamically changing the
$PATHis not the best solution either. Can’t we have the extra binaries somehow installed into~/.goenv/shimsinstead? And then get rid of these two lines:And still have correct
goand binaries versions.@kadaan Thanks, Your solution works for me.
And, my environment configuration.
@syndbg @pawamoy @attil-io @DuncanHills Why can’t we have the shims support binaries that get created by
go getcalls?I was able to get this to work locally by changing
go-rehash.list_executable_namesto:And
goenv-whence.whenceto:And lastly,
goenv-whichto:Once that is done, my shim path contains shims for binaries that got create by running
go get ...:And then
goenv whichworks:And
goenv whenceworks as well:Lastly, running the shimmed command works as well:
But if I’m in a different folder and the go version doesn’t have gox, then I get the correct response:
Finally, add the goenv-goget-plugin to goenv and it will automatically rehash when
go getcommands complete.Bump, I don’t really get the usefulness of this command if it doesn’t segregate the binary installation directory as well. The user can easily add a global go bin directory to their path but goenv should install and hash commands from the current go directory’s bin path.
@syndbg Same here.
Environment
Reproduce steps
Expected behavior
Can locate program file.
Actual behavior
Cannot locate program file.