#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "$0")/.."

# Mark the necessary Go modules as private to avoid Go's proxy
export GOPRIVATE="${GOPRIVATE:+$GOPRIVATE,}github.com/context-dot-dev/context-go-sdk/v2,github.com/context-dot-dev/context-go-sdk-staging/v2"



echo "==> Running tests"
go test ./... "$@"

echo "==> Checking tests on Windows"
GOARCH=amd64 GOOS=windows go test -c ./... "$@"
# `go test -c` produces a bunch of .exe files; make sure to clean those up
find . -name "*.test.exe" -exec rm {} \;
