Skip to content

Instantly share code, notes, and snippets.

@WindomZ
Created August 25, 2017 04:41
Show Gist options
  • Save WindomZ/e317706cdbd907634646733b79d55971 to your computer and use it in GitHub Desktop.
Save WindomZ/e317706cdbd907634646733b79d55971 to your computer and use it in GitHub Desktop.
golang cross compile
# linux 64bit
$ GOOS=linux GOARCH=amd64 go build
# with the -o option to specify the name of the generated binary file
$ 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment