#!/bin/sh set -eu # Run from the repository root. Browser execution is opt-in. mkdir -p bin test-results export GOFLAGS="${GOFLAGS:--buildvcs=false}" go list -f '{{.Dir}}' ./... | while IFS= read -r directory; do find "$directory" -maxdepth 1 -name '*.go' -exec gofmt -l {} + done > test-results/gofmt.txt if [ -s test-results/gofmt.txt ]; then cat test-results/gofmt.txt exit 1 fi go vet ./... CFBROWSER_INTEGRATION=0 CGO_ENABLED=0 go test ./... -count=1 -coverprofile=test-results/unit.cover CGO_ENABLED=0 go build -o bin/cfbrowser ./cmd/cfbrowser CGO_ENABLED=0 go build -o bin/cfbrowser-worker ./cmd/cfbrowser-worker if [ "${CFBROWSER_INTEGRATION:-0}" = 1 ]; then go test ./integration -count=1 -v -timeout=120s fi if [ "${CFBROWSER_RACE:-0}" = 1 ]; then CFBROWSER_INTEGRATION=0 CGO_ENABLED=1 go test -race ./... -count=1 -timeout=120s fi