moovweb / gvm

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

GVM does not function correctly in WSL #445

Open orhpeus opened 9 months ago

orhpeus commented 9 months ago

I am using gvm under WSL2. When the following script was added to the .bashrc, [[ -s "/home/m2m/.gvm/scripts/gvm" ]] && source "/home/m2m/.gvm/scripts/gvm"

I noticed that VS Code did not start properly. After looking at $PATH, it is found that the spaces in the path become colons. As shown in the following figure:

When GVM disabled: image

When GVM enabled: image

andot commented 9 months ago

I fix it in this pr: https://github.com/moovweb/gvm/pull/443

bamaas commented 9 months ago

Also facing this issue over here. Tried your fix @andot but still facing the same problem.

orhpeus commented 9 months ago

I temporarily used the following method to disable the resolution of Windows paths.

  1. Create a new /etc/wsl.conf configuration file under wsl and edit the following:

[interop] appendWindowsPath=false

ankitcharolia commented 8 months ago

@andot @orhpeus @bamaas kindly try this out. I am using this goenv: https://github.com/ankitcharolia/goenv.

k0b3rIT commented 7 months ago

I am facing the same issue on an ARM MAC with zsh.

k0b3rIT commented 7 months ago

@andot 's solution solves the problem THX!

goFrendiAsgard commented 6 months ago

For anyone who comes here because of this problem: @andot PR has been there since September 2023, and I don't think the maintainer (@moovops) will merge the PR in the near time.

You can always rollback to the point when the defect has not been introduced, or you can add this at the end of your ~/.zshrc or ~/.bashrc

export PATH=$(echo $PATH | sed 's/:\([^/]\)/ \1/g')

This workaround simply looks for any colon character that is not followed by a slash and replaces it with a space.