Go交叉编译

cooolr 于 2020-12-29 发布

查看当前 Go 版本支持的编译平台

go tool dist list

在 Linux 下编译 386 和 arm64 程序

CGO_ENABLED=0 GOOS=linux GOARCH=386 go build main.go

CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build main.go