vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

I changed .bashrc file but the extension still use old bashrc config

Open gjm-anban opened this issue 2 years ago • 2 comments

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.16 linux/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.70.2 e4503b30fc78200f846c62cf8091b76ff5547662 x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.35.2

Describe the bug

  1. I set export GOPATH=xxxx in $HOME/.bashrc
  2. but when I delete it in .bashrc, and try to run command 'go.tools.install' ,a exception appears image
  3. the extension shows the error image 4.I haven't export GOPATH but GOPATH still set image

how can i do to delete GOPATH env

gjm-anban avatar Aug 25 '22 08:08 gjm-anban

Use "unset GOPATH" in a shell to remove the variable from the environment. Could you try that, and re-run the go env command shown above, to see if it succeeds, and whether it still provides a value for GOPATH? Hopefully not, but if so, that would indicate that GOPATH is also in the go env configuration file, which can be updated with go env -w.

But the fact that the terminal within vscode still has GOPATH even after your .bashrc has removed it suggests that you need to restart the vscode process so that it gets the new environment.

adonovan avatar Aug 25 '22 16:08 adonovan

Use "unset GOPATH" in a shell to remove the variable from the environment. Could you try that, and re-run the go env command shown above, to see if it succeeds, and whether it still provides a value for GOPATH? Hopefully not, but if so, that would indicate that GOPATH is also in the go env configuration file, which can be updated with go env -w.

But the fact that the terminal within vscode still has GOPATH even after your .bashrc has removed it suggests that you need to restart the vscode process so that it gets the new environment.

I have tried unset GOPATH and restart my vscode process but it doesn't work. Finally I restart my vitrualmachine and it worked ,the GOPATH isn't exist any more,so I think the GOPATH might still store in somewhere until I restart machine. It can be a bug?

gjm-anban avatar Aug 26 '22 00:08 gjm-anban