Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ await gum('build')

const env: Record<string, string> = {
PATH: '/usr/bin:/bin:/usr/sbin:/sbin',
PKGX_DIR: useConfig().prefix.string
PKGX_DIR: useConfig().prefix.string,
// proxy.golang.org drops downloads mid-stream (`stream error … INTERNAL_ERROR`);
// `|` falls back to fetching from source on any error, `,` only on 404/410
GOPROXY: 'https://proxy.golang.org|direct'
}

// compute sanitized `env` the script will run within
Expand All @@ -120,6 +123,7 @@ for (const key of [
'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
'LANG', 'LOGNAME', 'USER', 'TERM' // prevent POSIX tools from breaking
]) {
const value = Deno.env.get(key)
Expand Down
5 changes: 3 additions & 2 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ await gum("test")

const env: Record<string, string> = {
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
}
for (const key of ['HOME', 'PKGX_PANTRY_PATH', 'PKGX_PANTRY_DIR', 'GITHUB_TOKEN', 'LANG', 'LOGNAME', 'USER', 'TERM']) {
for (const key of ['HOME', 'PKGX_PANTRY_PATH', 'PKGX_PANTRY_DIR', 'GITHUB_TOKEN', 'GOPROXY', 'LANG', 'LOGNAME', 'USER', 'TERM']) {
const value = Deno.env.get(key)
if (value) env[key] = value
}
Expand Down
Loading