GoForge — Build | Test | Ship | Collaborate GoForge — Build | Test | Ship | Collaborate
v1.0.3

direnv

Per-directory environments, typed at the core

$ go get goforge.dev/gpdirenv@v1.0.3

Current release — v1.0.3. goforge.dev/gpdirenv is a Go+ reimplementation of direnv/direnv v2.37.1, with differential parity verified against a freshly-built upstream binary. The current line consumes capability-scoped source loading from Go+ stdlib v0.207.0. Install with go get goforge.dev/gpdirenv@v1.0.3.

GoForge direnv targets direnv v2.37.1. The pure semantic cores are authored in Go+ and proven byte-for-byte against pinned upstream; the effectful engine and full 23-command CLI are Go+ too, producing a direnv binary that reports version 2.37.1 and matches upstream command-for-command.

Parity

  • Pure cores (Go+), byte-exact differential: dotenv (the .env parser), sri (SRI content hashes), gzenv (json+zlib+base64 snapshots), env (diff/patch/reverse), shell (all 12 renderers, incl. BashEscape/ FishEscape/TcshEscape/PowerShell escapers over all 256 bytes), and xdg.
  • Effectful engine + CLI (Go+): config (XDG + TOML), rc (allow/deny sha256 store, .envrc resolution), watches, and all 23 subcommands.
  • stdlib.sh is embedded byte-identical (the bash contract — use, layout, PATH_add, dotenv, …).
  • Verified against the upstream binary: 19 CLI subprocess cases (17 byte-identical modulo the embedded self-path; 2 set-identical where output order is Go map-iteration nondeterminism present in upstream too), plus the full .envrc load cycle (allow → export bash, spawning bash + running the embedded stdlib) producing identical exports, and matching status/exec.

Go+ idioms

Closed sums are Go+ enum/match: the RC permission state (AllowStatus { Allowed; NotAllowed; Denied }) and the SRI algorithm (Algo { SHA256; SHA384; SHA512 }), each with an ordinal/name projection so the wire formats — the integer direnv status exposes, the sha256-… hash strings — stay byte-identical. Generation is deterministic; goplus gen -check is clean against released goplus v0.138.0; race- and vet-clean.

Notes

Faithful to pinned upstream MIT provenance (© 2019 zimbatm and contributors). A few effect/network/editor commands (fetchurl, edit, prune, reload, watch) are ported and building but not yet exhaustively subprocess-diffed; see the repository’s PARITY.md for the honest ledger.