moovweb / gvm

Go Version Manager
http://github.com/moovweb/gvm
MIT License
10.38k stars 546 forks source link

`cd` command is slow #479

Open amorey opened 6 months ago

amorey commented 6 months ago

Thanks for making such a useful tool!

I noticed that the cd command slowed down significantly after installing gvm and I tracked down the issue to this script: $GVM_ROOT/scripts/env/cd. I understand the need for overloading cd but it would be helpful if the function ran faster or alternatively if there was a way to opt-in or opt-out. In my case I'm just using the global go version and most of my use of cd is not go-related so the extra cycles aren't necessary.

Here's my setup:

zsh 5.9 (x86_64-apple-darwin23.0)
gvm v1.0.22
macOS 14.5
irake99 commented 6 months ago

If you don't need go version auto-switching on cd, there is a workaround command unset cd to un-overloading cd.

You can put this command into ~/.bash_profile or ~/.zprofile.

amorey commented 6 months ago

Thanks! I had to add "-f" but this worked:

[[ -s "/path/to/home/.gvm/scripts/gvm" ]] && source "/path/to/home/.gvm/scripts/gvm"
unset -f cd