Golang 交叉编译 window/linux 文件

    • gox - 一款简单的交叉编译工具

下载地址:https://github.com/mitchellh/gox

  • 使用 go get 命令安装: go get github.com/mitchellh/gox

 

  •  同 go build 一样, 用 gox 编译项目 〉
  •  只生成linux平台amd64的文件: gox -osarch="linux/amd64"

 

 

  • 只生成windows平台amd64文件: gox -osarch="windows/amd64"

  

  • 只生成mac平台下的文件: gox -os "darwin"

 

  • 直接将编译好的 exe 或 linux 二进制文件上传上去执行即可 

 

posted @ 2018-02-07 12:36  酷酷的猿  阅读(204)  评论(0编辑  收藏  举报