#!/usr/bin/env bash

if [ -z "$1" ]; then
    echo "No GOOS specified as first arg, using the current system GOOS"
    GOOS_BUILD=$(go env GOOS)
else
    GOOS_BUILD=$1
fi

if [ -z "$2" ]; then
    echo "No GOARCH specified as second arg, using the current system GOOS"
    GOARCH_BUILD=$(go env GOARCH)
else
    GOARCH_BUILD=$1
fi

echo "Building for $GOOS_BUILD $GOARCH_BUILD"
# build the exutable and include GOOS and GOARCH in the name

GOOS=$GOOS_BUILD GOARCH=$GOARCH_BUILD go build -o bin/actions-sync-"$GOOS_BUILD"-"$GOARCH_BUILD" main.go
