#!/usr/bin/env bash set -euo pipefail python3 - <<'PY' import re for path, secs in [('internal/fetch/fetch.go','5'), ('internal/health/health.go','2'), ('internal/proxy/proxy.go','30')]: s=open(path).read() s=s.replace('import (\n\t"time"\n', 'import (\n\t"context"\n\t"time"\n') s=re.sub(r'httpx\.Do\(url, \d+\*time\.Second\)', 'httpx.Do(context.Background(), url, httpx.Options{Timeout: %s * time.Second})' % secs, s) open(path,'w').write(s) PY