Setting the GOPATH
variable global as an enviroment variable works fine with Visual Studio Code.
But setting a project specific variable globally doesn't seem very nice to me. Consider you have multiple Go
projects, you would have to change this variable each time you, compile, debug, ... etc. a project.
Is there a possibility to set the GOPATH
variable as a project variable in Visual Studio Code? Ether in settings.json
or launch.json
?
set workspace settings
, in windows:
ctrl+,
set workspace setting:
{
"go.gopath": "d:\\gopath;E:\\src"
}
use ;
for multiple path
If your VSCode project directory is organized,
Then VSCode infers GOPATH from your workspace root, which solves my problem immediately. I believe this is explained in other answers. I am posting this just to give a shorter version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With