golang在Windows环境编译Linux可执行文件

下载go和git并安装

  • https://golang.org/dl/
  • https://git-scm.com/downloads

下载gdrive的golang源码:https://github.com/gdrive-org/gdrive/archive/master.zip

编译

SET CGO_ENABLED=0

SET GOOS=linux

SET GOARCH=386

go get github.com/prasmussen/gdrive

go build -ldflags "-w -s"

如果编译64位版本,上面GOARCH改为amd64;如果编译arm版本上面GOARCH改为arm

参考:

https://github.com/gdrive-org/gdrive/issues/426

https://blog.csdn.net/panshiqu/article/details/53788067

评论

Popular Posts

如何提高自己的领悟力

女生可以对男朋友心机到什么程度?(苦)

缓解由显示器造成的眼睛疲劳

常用的国内外延迟测速链接(generate_204)

信任,系情缘

等你下课 - 周杰伦

获得友谊的三大秘诀(延伸:生活之道为人之道)

Postman 5.5.3 - API接口调试工具

太阳的后裔 Descendants of the Sun

《不可思议》 金莎