Merge pull request #6 from beatz174-bit/codex/add-goproxy-validation-and-update-readme

Add GOPROXY validation warnings to setup scripts and README
This commit is contained in:
beatz174-bit
2026-04-21 15:42:27 +10:00
committed by GitHub
3 changed files with 76 additions and 0 deletions
+22
View File
@@ -93,6 +93,28 @@ Covers focused package behavior (client parsing, mappers, provider helper logic)
go test ./...
```
### Troubleshooting Go dependency downloads
If you see an error like:
```text
GOPROXY list is not the empty string, but contains no entries
```
your local Go environment is misconfigured. A common fix is:
```bash
go env -w GOPROXY=https://proxy.golang.org,direct
```
Helpful diagnostics:
```bash
go env GOPROXY
echo "$GOPROXY"
```
### Acceptance tests
### Tier B: local integration tests (mock Dynu API, no real credentials)
These tests use an `httptest` fake Dynu API server and run the Terraform provider end-to-end against deterministic fixtures.
+27
View File
@@ -14,6 +14,33 @@ for cmd in bash git; do
have "$cmd" || die "$cmd is required"
done
validate_goproxy() {
local value="$1"
local part trimmed
local has_valid=0
IFS=',' read -r -a parts <<<"$value"
for part in "${parts[@]}"; do
trimmed="${part#"${part%%[![:space:]]*}"}"
trimmed="${trimmed%"${trimmed##*[![:space:]]}"}"
if [[ -n "$trimmed" ]]; then
has_valid=1
break
fi
done
if [[ "$has_valid" -eq 0 ]]; then
warn "GOPROXY appears malformed: non-empty value contains no entries"
warn "This can cause errors like: GOPROXY list is not the empty string, but contains no entries"
warn "Suggested fix: go env -w GOPROXY=https://proxy.golang.org,direct"
warn "Current GOPROXY from environment: '$value'"
fi
}
if [[ "${GOPROXY+x}" == "x" ]]; then
validate_goproxy "$GOPROXY"
fi
ensure_dir .codex
ensure_dir .codex/bin
ensure_dir .codex/cache
+27
View File
@@ -11,6 +11,33 @@ for cmd in bash git go; do
echo "[setup-dev] $cmd: $(command -v "$cmd")"
done
validate_goproxy() {
local value="$1"
local part trimmed
local has_valid=0
IFS=',' read -r -a parts <<<"$value"
for part in "${parts[@]}"; do
trimmed="${part#"${part%%[![:space:]]*}"}"
trimmed="${trimmed%"${trimmed##*[![:space:]]}"}"
if [[ -n "$trimmed" ]]; then
has_valid=1
break
fi
done
if [[ "$has_valid" -eq 0 ]]; then
echo "[setup-dev][warn] GOPROXY appears malformed: non-empty value contains no entries." >&2
echo "[setup-dev][warn] This can cause errors like: GOPROXY list is not the empty string, but contains no entries." >&2
echo "[setup-dev][warn] Suggested fix: go env -w GOPROXY=https://proxy.golang.org,direct" >&2
echo "[setup-dev][warn] Current GOPROXY from environment: '$value'" >&2
fi
}
if [[ "${GOPROXY+x}" == "x" ]]; then
validate_goproxy "$GOPROXY"
fi
if command -v terraform >/dev/null 2>&1; then
echo "[setup-dev] terraform: $(command -v terraform)"
else