Skip to content

build/test: default GOPROXY to proxy.golang.org|direct - #369

Merged
jhheider merged 1 commit into
mainfrom
goproxy-fallback
Oct 28, 2026
Merged

jhheider merged 1 commit into
mainfrom
goproxy-fallback

Conversation

@jhheider

Copy link
Copy Markdown
Contributor

proxy.golang.org intermittently drops module zips mid-download (stream error: stream ID N; INTERNAL_ERROR; received from peer). It failed eight pantry builds in two days (coder ×3, odigos, openbao, wails ×2, gitlab-runner), each fixed by a plain rerun.

build.ts and test.ts run their scripts with clearEnv: true, so a GOPROXY set in the pantry workflow never reaches go. This sets a default in brewkit instead:

  • GOPROXY=https://proxy.golang.org|direct. The | separator falls back to fetching from the module's source on any proxy error; , only falls back on 404/410, so it wouldn't help here.
  • GOPROXY joins the pass-through list, so a caller's value overrides the default.
  • Direct fetches are still verified against go.sum and sum.golang.org.

Validation

bk on charm.sh/gum, with a clean module cache each time:

caller env result
GOPROXY=http://127.0.0.1:1 build fails: override reaches go
GOPROXY='http://127.0.0.1:1|direct' builds: fallback works
unset builds, bk test and bk audit pass

Before this change, the dead-proxy case built fine because the variable was dropped.

deno test --allow-env --allow-net --ignore=.data has the same 5 local failures with and without this change.

🤖 Generated with Claude Code

proxy.golang.org intermittently drops module zips mid-download
(`stream error: … INTERNAL_ERROR; received from peer`), failing pantry
builds that a rerun then fixes. The build and test scripts run with a
cleared env, so a GOPROXY set in CI never reached them.

Default GOPROXY to `https://proxy.golang.org|direct`: the `|` separator
falls back to fetching from the module's source on any proxy error
(`,` only falls back on 404/410). Modules fetched direct are still
verified against go.sum and sum.golang.org. GOPROXY is also on the
pass-through list, so a caller's value overrides the default.

Exercised locally with `bk` on charm.sh/gum (build, test, audit):
- caller GOPROXY=http://127.0.0.1:1 fails (override reaches go)
- caller GOPROXY='http://127.0.0.1:1|direct' builds (fallback works)
- GOPROXY unset builds and tests normally
`deno test` has the same 5 local failures with and without the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 01:46
@jhheider
jhheider merged commit 51661fa into main Oct 28, 2026
37 checks passed
@jhheider
jhheider deleted the goproxy-fallback branch October 28, 2026 01:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Tests may lack Git for fallback, GOPROXY credentials can leak to logs, Docker drops the override, and omitted Go privacy settings can expose private module paths.

4 open issues
What changed in this PR

This PR updates brewkit’s build and test environments to recover from Go module proxy errors by falling back to direct source downloads.

Changes:

  • Default GOPROXY to https://proxy.golang.org|direct, allowing fallback on any proxy error.
  • Pass through caller-supplied GOPROXY values to override the default.
File Description
test/​test.ts Adds the proxy default and caller override to the sanitized test environment.
build/​build.ts Adds the same build configuration and documents the fallback separator.

Review effort: Balanced

Comment thread build/build.ts
'PKGX_PANTRY_PATH', // otherwise we cannot build against the user’s pantry
'PKGX_PANTRY_DIR', // otherwise we cannot build against the user’s pantry - v2
'GITHUB_TOKEN', // pass through for `gh` and that sort of thing
'GOPROXY', // the caller’s choice wins over the default above
Comment thread build/build.ts
'PKGX_PANTRY_PATH', // otherwise we cannot build against the user’s pantry
'PKGX_PANTRY_DIR', // otherwise we cannot build against the user’s pantry - v2
'GITHUB_TOKEN', // pass through for `gh` and that sort of thing
'GOPROXY', // the caller’s choice wins over the default above
Comment thread build/build.ts
'PKGX_PANTRY_PATH', // otherwise we cannot build against the user’s pantry
'PKGX_PANTRY_DIR', // otherwise we cannot build against the user’s pantry - v2
'GITHUB_TOKEN', // pass through for `gh` and that sort of thing
'GOPROXY', // the caller’s choice wins over the default above
Comment thread test/test.ts
PATH: '/usr/bin:/bin:/usr/sbin:/sbin',
PKGX_DIR: useConfig().prefix.string
PKGX_DIR: useConfig().prefix.string,
GOPROXY: 'https://proxy.golang.org|direct' // see build.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants