#! /bin/bash

function main() {
   cd "$(dirname "$BASH_SOURCE")"
   set -e
   go test ./...
   GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=0 go build -o $(basename "$PWD") -a -installsuffix cgo
   scp ./dndex zach@192.168.1.123:./dndex/dndex.new
   ssh zach@192.168.1.123 bash -c 'true; while [ -e ./dndex/dndex.new ]; do printf "."; sleep 3; done; echo'
}

if [ "$0" == "$BASH_SOURCE" ]; then
   main "$@"
fi
