Repository navigation
build/test: default GOPROXY to proxy.golang.org|direct - #369
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 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
GOPROXYtohttps://proxy.golang.org|direct, allowing fallback on any proxy error. - Pass through caller-supplied
GOPROXYvalues 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
| '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 |
| '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 |
| '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 |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.tsandtest.tsrun their scripts withclearEnv: true, so aGOPROXYset in the pantry workflow never reachesgo. 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.GOPROXYjoins the pass-through list, so a caller's value overrides the default.go.sumand sum.golang.org.Validation
bkoncharm.sh/gum, with a clean module cache each time:GOPROXY=http://127.0.0.1:1goGOPROXY='http://127.0.0.1:1|direct'bk testandbk auditpassBefore this change, the dead-proxy case built fine because the variable was dropped.
deno test --allow-env --allow-net --ignore=.datahas the same 5 local failures with and without this change.🤖 Generated with Claude Code