语音解读
图文解释
检查配置PATH
$ open -e ~/.bash_profile
插入下列值
export GOROOT=/usr/local/go export GOPATH=~/work export GOBIN=~/work/bin export PATH=$PATH:$GOBIN
保存并退出
$ source ~/.bash_profile
将当前系统版本的/usr/local/go目录全部拷贝到$HOME/go1.4
$ sudo cp -R /usr/local/go ~/go1.4
下载最新的golang源码(go1.7.2)
$ cd ~/ $ git clone https://go.googlesource.com/go $ sudo cp -R ~/go /usr/local/go
编译最新版本
$ cd $GOROOT/src $ sudo ./all.bash
编译交叉编译环境
$ sudo CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./make.bash $ sudo CGO_ENABLED=0 GOOS=windows GOARCH=386 ./make.bash
安装 Beego 和 Bee 的开发工具
$ go get github.com/astaxie/beego $ go get github.com/beego/bee $ cd $GOPATH/src/github.com/beego/bee $ CGO_ENABLED=0 make
用bee工具快速新建一个beegoproject实例
$ cd $GOPATH/src/ $ bee new beegoproject
测试运行
$ cd beegoproject $ bee run
打包
$ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $ CGO_ENABLED=0 GOOS=windows GOARCH=386 go build
- beego bee工具打包
$ bee pack -be GOOS=linux -be GOARCH=amd64 $ bee pack -be GOOS=windows $ bee pack -be GOOS=windows -be GOARCH=386