After installing Golang and setting up the GOPATH in .bashrc, I am not able to install the Gopls and other tools that VSCode requires to be installed.
When I am clicking the Install button in the VSCode popup, it fails to install stating permission issues. On going through the error logs, I see that VSCode is trying to install the packages to the GOBIN directory which is set to /user/local/bin. This directory by default is read-only, therefore the installation is failing.
I can solve this issue by using the Linux terminal by installing the packages with sudo. But that's not the point. I want to fix the issue within VSCode itself.
I know it's not a Golang issue, but something related to Linux.
The issue can be fixed by unsetting the
GOBINenv variable by:You can cross-check all the go env by:
go envOn restarting the VSCode and clicking the "Install" button in the pop-up, the packages are installed in the
GOPATH, which is an editable directory.