envvar

package
v6.16.10 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package envvar provides utilities for working with environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(value string) string

Expand replaces ${VAR_NAME}, ${VAR_NAME:-default}, and ${VAR_NAME:=default} placeholders with their environment variable values. If a referenced environment variable is not set:

  • With default syntax ${VAR:-default} or ${VAR:=default}: uses the default value
  • Without default ${VAR}: uses empty string and logs a warning

func ExpandBytes

func ExpandBytes(data []byte) []byte

ExpandBytes expands environment variables in byte slice content. This is a convenience wrapper for expanding YAML or other file content.

func ExpandWithLookup

func ExpandWithLookup(value string, lookup func(string) (string, bool)) string

ExpandWithLookup expands placeholders using the provided lookup function. The lookup function is checked before default handling. If lookup is nil, it defaults to os.LookupEnv.

Types

This section is empty.

Jump to

Keyboard shortcuts

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