This is a creation in Article, where the information may have evolved or changed.
-
- Installing Golang
- Install vs Code
- Configuring the Debug environment
Installing Golang
-
1. Download the Golang installation package
-
2. Unzip to the installation path:
$HOME/your_path -xzf go$VERSION.$OS-$ARCH.tar.gz
-
3. Set the environment variable Goroot, Gopath, and add the bin directory to path:
export GOROOT=$HOMEexport PATH=$PATH:$GOROOT/binexport GOPATH=$HOME/work/mygo
Install vs Code
- Download install vs Code and install the Golang plugin
- Tools Required for installing plugins
- Go get will have half error, mainly golang.org/x/the following list of items cannot be accessed. These projects are actually hosted on GitHub, but the path remains the original path to remain compatible, so create the
$GOPATH/src/
corresponding directory in the directory: mkdir $GOPATH/src/golang.org/x/
then go to github and download the repo locally.git clone https://github.com/golang/tools
Configuring the Debug environment
- Installing delve
go get github.com/derekparker/delve/cmd/dlv
- Configure the Launch.json file, "program" is the path where the debug files are located