envutil

package
v2.0.0-alpha.39 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package envutil exposes the v1 envutil package-level function names on top of the v2 env package so existing callers can migrate by import path rename only. New code should call env.Revokable, env.Scoped, etc. directly with an env.Repository (or any value satisfying env.Getter / env.GetSetter), while these package-level wrappers touch the real process environment unconditionally.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetenvWithDefault deprecated

func GetenvWithDefault(envKey, defValue string) string

GetenvWithDefault returns the value of envKey when it is set and non-empty, else defValue.

Deprecated: use env.GetOrDefault for testable env access.

func RequiredEnv deprecated

func RequiredEnv(envKey string) (string, error)

RequiredEnv returns the value of envKey or an error when it is unset or empty.

Deprecated: use env.Required for testable env access.

func RevokableSetenv deprecated

func RevokableSetenv(key, value string) (func() error, error)

RevokableSetenv sets key to value and returns a function that restores the previous value.

Deprecated: use env.Revokable for testable env access.

func RevokableSetenvs deprecated

func RevokableSetenvs(envs map[string]string) (func() error, error)

RevokableSetenvs applies every entry in envs and returns a single function that restores all previous values.

Deprecated: use env.RevokableMany for testable env access.

func SetenvForFunction deprecated

func SetenvForFunction(key, value string, fn func()) error

SetenvForFunction sets key to value, invokes fn, and then restores the previous value. The restore runs even if fn panics.

Deprecated: use env.Scoped for testable env access.

func SetenvsForFunction deprecated

func SetenvsForFunction(envs map[string]string, fn func()) error

SetenvsForFunction applies every entry in envs, invokes fn, and then restores all previous values. The restore runs even if fn panics.

Deprecated: use env.ScopedMany for testable env access.

func StringFlagOrEnv deprecated

func StringFlagOrEnv(flagValue *string, envKey string) string

StringFlagOrEnv returns *flagValue when it points to a non-empty string, else the value of envKey.

Deprecated: use env.FlagOrEnv for testable env access.

Types

This section is empty.

Jump to

Keyboard shortcuts

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