I'm doing quite a few Go programming these days in Visual Studio Code for Mac and find the following approach to running it quite useful:
Add the plugin "Go" to rich language support.
SDK/golang-vscode/binin user's folder:
mkdir -p ~/SDK/golang-vscode/bin.
Add this folder to the path environment variable by running the command
export PATH=$PATH:~/SDK/golang-vscode/binand then adding it to
#!/bin/bash GOPATH=`pwd` PATH=$PATH:`pwd`/bin code `pwd` $*
- Navigate to
vscodego test.go. Editor should ask whether to install tools, click Install.
Now in any Golang project's folder run
vscodego and Visual Studio Code should open with
GOPATH set to the current folder and
bin subfolder in the path.
And you can run
vscodego from different folders and work on two projects in the same time with correct
GOPATH set for each editor window.