1.

安装go并设置环境变量

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile(for a system-wide installation) or $HOME/.profile:

export PATH=$PATH:/usr/local/go/bin

Note: changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source $HOME/.profile.

=======================================================

First, set Go’s root value, which tells Go where to look for its files.

sudo nano ~/.profile

At the end of the file, add this line:

export PATH=$PATH:/usr/local/go/bin

If you chose an alternate installation location for Go, add these lines instead to the same file. This example shows the commands if Go is installed in your home directory:

export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin

With the appropriate line pasted into your profile, save and close the file. Next, refresh your profile by running:

source ~/.profile

============================设置完记得重启(重新登陆)!!!===================================

go语言下载和安装和校验 官方链接:

https://golang.org/doc/install?download=go1.10.3.linux-amd64.tar.gz
posted on 2018-08-03 22:52  王庆东mas  阅读(99)  评论(0编辑  收藏  举报