go项目使用gox交叉编译,生成跨平台的可执行文件
【第一次安装】 1.安装gox $ go get github.com/mitchellh/gox $ cd $GOPATH/src/github.com/mitchellh/gox $ go build 2.编辑~/.bash_profile(bsh) 或者~/.zshrc(zsh) 添加一行: alias gox="$GOPATH/src/github.com/mitchellh/gox/gox" 新开终端,让设置生效。 3.生成本地工具链(如果go版本升级,比如从1.3.3升级到1.4,需要重新运行这个命令先) $ gox -build-toolchain 【交叉编译项目】 1.比如有一个项目的目录在$GPATH/src/hello $cd $GPATH/src/hello $gox ...阅读全文