Documentation
¶
Overview ¶
Package envutil provides shared helpers for building process environment variable slices from os.Environ() plus a caller-supplied override map.
It is intentionally small and depends only on the standard library so that any sub-package of internal/worker can import it without creating a cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build constructs a process environment slice by starting from os.Environ() and applying overrides on top. Keys present in overrides take precedence over the inherited environment. When overrides is empty the raw os.Environ() slice is returned directly (no allocation).
The output format is "KEY=VALUE", matching exec.Cmd.Env expectations. Output order is non-deterministic (map iteration); callers must not rely on any specific ordering.
func BuildWithUnset ¶
BuildWithUnset is like Build but additionally removes every key in unset from the resulting environment — including keys inherited from os.Environ() and keys supplied via overrides. This implements OpenJD's openjd_unset_env directive, where a variable must be absent from a subsequent action's environment even if it was set by the worker's own environment or by a static environment Variables entry.
Removal is applied after overrides, so a key present in both overrides and unset is removed. When unset is empty the call is equivalent to Build.
The output format is "KEY=VALUE"; output order is non-deterministic.
Types ¶
This section is empty.