sudo apt-get install python-setuptools python-dev build-essential //安装开发环境
sudo apt-get install mercurial 安装代码管理工具hg
hg clone -u release https://go.googlecode.com/hg/ go clone源代码到本地
cd go/src
./all.bash 编译
配置go环境变量vim .profile
export GOROOT=$HOME/go ##go的根路径
export GORACH=amd64#go工作的系统amd64位
export GOOS=linux
配置gopath,设置工作空间,该目录下有bin ,src,pkg目录,源代码放在src
export GOPATH=$HOME/gocode
exoprt PATH=$PATH:$HOME/go/bin:$GOPATH/bin
编辑结束后
source .profile
至此go配置完成
使用supervisor监控运行编译好的程序如:注意:要用root用户琼supervisor否则,test应用会因为user的注销用户,工作异常
[program:test]
directory = /home/user/gocode/test/
command=/home/user/gocode/qxnzycms/bin/test
autostart = true
startsecs = 3
autorestart=true
user = root
redirect_stderr = true
stdout_logfile = /home/user/gocode/test/test.log