First, installation
sudo apt-get install Golang
Second, create a working space
Under the/home directory, create a directory named Gopath (name any) to create three subdirectories in that directory (the name must be SRC, pkg, and bin). The process of creating a directory is as follows:
Image.png
SRC--Each subdirectory inside is a package. Baone is the go source file
PKG--The target file of the package generated after compilation
Bin--The resulting executable file.
Third, configure environment variables
1. Open the configuration file
Run the following command:
$ gedit ~/.BASHRC
2, add command
Add the following command at the end of the file:
Export Gopath=/home/gopath
3, the order takes effect
Run the following command
$ source ~/.BASHRC
IV. test Environment
Run the following command
$ go version
Visible
Image.png
V. Open the Goland for development.
Image.pngimage.png