Skip to content

Instantly share code, notes, and snippets.

@TwiN
Created April 29, 2019 12:24
Show Gist options
  • Save TwiN/8c2bfad486bdf979ee14649a1aff334c to your computer and use it in GitHub Desktop.
Save TwiN/8c2bfad486bdf979ee14649a1aff334c to your computer and use it in GitHub Desktop.
Multi-platform bash script to build Go binaries
#!/bin/bash
APPLICATION_NAME="appname"
env GOOS=darwin GOARCH=amd64 go build -o bin/darwin/${APPLICATION_NAME}-darwin64
env GOOS=linux GOARCH=amd64 go build -o bin/linux/${APPLICATION_NAME}-linux64
env GOOS=windows GOARCH=amd64 go build -o bin/windows/${APPLICATION_NAME}-windows64.exe
chmod +x bin/darwin/${APPLICATION_NAME}-darwin64
chmod +x bin/linux/${APPLICATION_NAME}-linux64
chmod +x bin/windows/${APPLICATION_NAME}-windows64.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment