Ubuntu Settings Gopath,goroot Environment variables

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.