1, Ubuntu Save environment variables in several files
/etc/profile
The first file that is used when the operating system customizes the user's environment when the user logs on, which sets the environment information for each user of the system, and the file is executed the first time the user logs on. /etc/environment
The second file that the operating system uses when the user logs on, setting the environment variable for the environment file before reading the user profile. ~/.profile
The third file that is used when a user logs on is a. profile file that each user can use to enter shell information that is specific to their own use, and that file is executed only once when the user logs on. By default, some environment variables are set to execute the user's. bashrc file. /ETC/BASHRC
This file is executed for each user running the bash shell, and the file is read when the bash shell is opened. ~/.BASHRC
The file contains bash information dedicated to the user's Bash shell, which is read when you log on and each time you open a new shell. Note: The above file can be opened via the $ sudo gedit filename or $ sudo vim file name, it is recommended to modify only the ~/.profile file, if you modify the ~/.BASHRC file only, you will be prompted Gopath not set when you use the go Get command later. 2, set Gopath and Goroot $ sudo gedit ~/.profile at the end of the file add
Export goroot= "/usr/lib/go-1.8"/quotes set for your own go installation directory
export gobin= $ goroot/bin
export gopath= "/home/test/ Gopath "//quotation marks set to your own go item's working interval
export path= $PATH: $GOPATH/bin ///The original path followed by a colon to connect the new path
Make the file effective immediately, $ source ~/.profile
Reboot The System 3, go Project IDE liteide vscode
Reference: http://blog.csdn.net/typ2004/article/details/39559873