Last active
December 20, 2017 11:25
-
-
Save slv922/d47853e241b8505a36d6a870ca265aef to your computer and use it in GitHub Desktop.
Golang Cross-compile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 编译到 linux 64bit | |
$ GOOS=linux GOARCH=amd64 go build | |
# 或者可以使用 -o 选项指定生成二进制文件名字 | |
$ GOOS=linux GOARCH=amd64 go build -o app.linux | |
# 编译到 linux 32bit | |
$ GOOS=linux GOARCH=386 go build | |
# 编译到 windows 64bit | |
$ GOOS=windows GOARCH=amd64 go build | |
# 编译到 windows 32bit | |
$ GOOS=windows GOARCH=386 go build | |
# 编译到 Mac OS X 64bit | |
$ GOOS=darwin GOARCH=amd64 go build | |
Ref: http://dmdgeeker.com/goBook/docs/ch01/cross_compile.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment