envutil

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package envutil provides helpers for threaded environment variable management. Instead of mutating the global process environment with os.Setenv (which causes race conditions between concurrent runs), callers pass explicit env var maps through the execution chain. Each helper falls back to the process environment when the explicit map is nil (CLI path).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lookup

func Lookup(envVars map[string]string, key string) string

Lookup returns the value for key from envVars. When envVars is nil, falls back to os.Getenv(key) — preserves the legacy "no map = inherit process env" behavior. When envVars is non-nil, returns "" for absent keys (no fallback) so dev-shell process env can't leak into callers that pass an explicit map.

func MergeWithProcessEnv

func MergeWithProcessEnv(envVars map[string]string) []string

MergeWithProcessEnv returns a copy of os.Environ() with the provided env vars merged on top. If envVars is nil, returns os.Environ() as-is.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL