This is a creation in Article, where the information may have evolved or changed.
-
-
- Install Go
- Configuring Environment variables
- Set permissions
- Set Gopath
- Install Vscode Go
- Installing delve
Install Go
Select the installation package (. tar.gz file) that matches your system from the download address, my Elemenray OS 32 bit, I chose go1.6.linux-386.tar.gz
After downloading, cd go to the download directory and use the command
-xzf go1.6.linux-386.tar.-C /usr/local
Most of the methods on the Internet are extracted to /usr/local/ , but I myself in the back Vscode install the Go plugin often encountered a permission error, causing the plug-in cannot be installed, so it is recommended to install under the user home directory
sudo tar -xzf go1.6.linux-386.tar.gz -C /home/kingeasternsun
Configuring Environment variables
Configure the environment variables of Ubuntu, I want the global user to be able to use, so Modified "/etc/profile", at the end of this file to add the following content:
export GOROOT=/home/kingeasternsun/goexport GOBIN=/home/kingeasternsun/go/binexport PATH=$PATH:$GOBINexport GOPATH=/home/kingeasternsun/goproject
Set permissions
This is for the go language decompression to the /usr/local use of
To ensure that Vscode installs the Go plugin successfully, set the following
chmod777 /usr/local/go/bin
Set Gopath
Vscode Install go plugin will prompt Gopath not set error, then open Launch.json in the inside Env set
Install Vscode Go
Search for Go in the Vscode App Store and click Install.
Installing delve
Vscode prompt for the following error
Delve only supports 64-bit!!!
Refer to the following https://github.com/derekparker/delve/issues/514