Skip to content

fix: stop overwriting process.env.GOPRIVATE in the Go installers - #155

Merged
ravor-x merged 3 commits into
mainfrom
claude/goprivate-no-process-env
Dec 3, 2026
Merged

ravor-x merged 3 commits into
mainfrom
claude/goprivate-no-process-env

Conversation

@ravor-x

@ravor-x ravor-x commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Problem

The atl, esq, n8n and discordctl installers assign process.env.GOPRIVATE = 'github.com/enthus-appdev/*' (lib/installers/{atl,esq,n8n,discord}.js). environment-setup imports this package into its own process, so after one of them runs, every later go call there sees only github.com/enthus-appdev/*. An exported variable also wins over go env -w, so environment-setup's experts install loses github.com/enthus-ai/*, asks the public checksum database about the private module and fails with 404 Not Found on every "Force update all". Diagnosed in enthus-appdev/environment-setup#497.

Fix

Every installer already passes GOPRIVATE to its own go install (env: { ...process.env, GOPRIVATE } in esq and discord, a GOPRIVATE=… go install prefix in atl and n8n). The process.env assignment adds nothing to the install, so it is removed rather than made to extend the value.

  • test/process-env.test.js: no module under lib/ assigns GOPRIVATE, GONOSUMDB, GONOPROXY or GOFLAGS to process.env.
  • CLAUDE.md: the private-repo pattern now says to pass GOPRIVATE per command and why.

environment-setup#497 stays useful on its own: it makes the experts install independent of whatever the shell exports.

Testing

  • The new test fails on main (lists all four installers) and passes here.
  • npm test: 62/62 pass. eslint lib test: clean.
  • Not run: a live install of atl, esq, n8n or discordctl; the install commands themselves are unchanged.

The atl, esq, n8n and discordctl installers assigned
process.env.GOPRIVATE = 'github.com/enthus-appdev/*'. environment-setup
imports this package into its own process, so the assignment replaced
its GOPRIVATE for every later go call there; the experts install then
lost github.com/enthus-ai/* and failed against the public checksum
database (environment-setup#497).

Every installer already passes GOPRIVATE to its own go install, so the
assignment did nothing for the install and is removed. A test guards
that no module under lib/ assigns Go module settings to process.env.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request removes direct assignments of GOPRIVATE to process.env across several installer modules (atl, discord, esq, and n8n) to prevent polluting the host process environment. It also adds a regression test to ensure Go environment variables are not directly assigned to process.env. Feedback on the pull request suggests enhancing the regression test's regular expression to also detect bracket notation assignments, ensuring more robust coverage.

Comment thread test/process-env.test.js Resolved
@ravor-x
ravor-x marked this pull request as ready for review December 3, 2026 10:44

@smini-digital smini-digital 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.

Comment, not approval. The fix is correct and complements environment-setup#497; the two PRs can merge in either order.

What I checked on b51a838:

  • Nothing relied on the removed assignment. Every installer still passes GOPRIVATE to its own go install: esq and discord via env: { ...process.env, GOPRIVATE }, atl and n8n via the GOPRIVATE=… go install prefix. The update path (goToolUpdate in lib/utils/versions.js) calls those same install functions, and latestGoVersion uses git ls-remote, which does not read GOPRIVATE.
  • The new test fails on revert. With lib/ from main, test/process-env.test.js fails and lists exactly installers/atl.js, discord.js, esq.js and n8n.js. On the PR head npm test passes 62/62.

Not blocking:

  1. CI does not run npm test. The checks are format, lint, CodeQL and the license check, so the new guard only runs locally. This predates the PR, but a test job would make the guard enforced.
  2. environment-setup only gets the fix after a release. Its lockfile pins @enthus-appdev/llm-cli-setup at 1.15.0, so a version bump there is needed once this is published.
  3. Nit: goToolUpdate still sets process.env.GOBIN process-wide. It restores the value in finally and the installs are synchronous, so I see no real problem today. The new test does not cover GOBIN.
  4. Pre-existing, Windows: the GOPRIVATE=… go install prefix in atl and n8n is not valid cmd.exe syntax, and there is no win32 branch.

@ravor-x
ravor-x merged commit d0f0c4b into main Dec 3, 2026
7 checks passed
@ravor-x
ravor-x deleted the claude/goprivate-no-process-env branch December 3, 2026 11:02
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