Last active
July 22, 2021 09:19
-
-
Save Lajule/0d4a04a05065647786ee64a1ee76fbe0 to your computer and use it in GitHub Desktop.
Golang cross compiling
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
#!/bin/bash | |
set -ex | |
cwd="${PWD}" | |
for goos in darwin linux windows; do | |
for goarch in 386 amd64; do | |
(cd "${0%/*}" \ | |
&& GOOS="${goos}" GOARCH="${goarch} go build -o "${cwd}/${1}_${goos}_${goarch}") || exit $? | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment