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

随身WiFi折腾指南: 解锁、刷机与DIY

mihomo各平台客户端下载(windows, android, macos)

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

WPS Office教育考试专用版

Cromite - 极度注重隐私的Chromium浏览器

其实所有的电影都很枯燥

ThinkPHP - 开源PHP框架

优化PC端B站(Bilibili)免登录观看体验

Windows Thin PC - 微软官方精简版Win7