1、GOROOT就是go的安装路径。在/etc/profile文件中加上GOROOT
[root@localhost ~]# vim /etc/profile export GOROOT=/usr/local/go export PATH=/usr/local/nginx/sbin:/usr/local/mysql/bin:$GOROOT/bin:$PATH [root@localhost ~]# source /etc/profile
2、GOPATH就是你工作项目的路径。在/etc/profile文件中加上GOPATH
[root@localhost ~]# vim /etc/profile export GOROOT=/usr/local/go export GOPATH=/data/wwwroot/beego export PATH=/usr/local/nginx/sbin:/usr/local/mysql/bin:$GOROOT/bin:$GOPATH/bin:$PATH [root@localhost ~]# source /etc/profile
3、下载安装
[root@localhost wwwroot]# go get github.com/astaxie/beego [root@localhost wwwroot]# ll total 0 drwxr-xr-x 4 root root 26 Jul 28 17:40 beego drwxr-xr-x 2 www www 23 Jul 28 16:05 default
备注:GOROOT、GOPATH路劲必须是绝对路径。(操作以上命令在一个窗口下执行,否则下载时会出错。)
您可以选择一种方式赞助本站