environ

package
v3.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 5 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environ

type Environ []string

environ is a slice of strings representing the environment, in the form "key=value".

func (*Environ) IsSet

func (e *Environ) IsSet(key string) bool

IsSet returns whether or not a key is currently set in the environ

func (*Environ) Load

func (e *Environ) Load(ctx context.Context, s store.Store, service string, collisions *[]string) error

Load loads environment variables into e from s given a service collisions will be populated with any keys that get overwritten

func (*Environ) LoadStrict

func (e *Environ) LoadStrict(ctx context.Context, s store.Store, valueExpected string, pristine bool, services ...string) error

LoadStrict loads all services from s in strict mode: env vars in e with value equal to valueExpected are the only ones substituted. If there are any env vars in s that are also in e, but don't have their value set to valueExpected, this is an error.

func (*Environ) Map

func (e *Environ) Map() map[string]string

Map squashes the list-like environ, taking the latter value when there are collisions, like a shell would. Invalid items (e.g., missing `=`) are dropped

func (*Environ) Set

func (e *Environ) Set(key, val string)

Set adds an environment variable, replacing any existing ones of the same key

func (*Environ) Unset

func (e *Environ) Unset(key string)

Unset an environment variable by key

type ErrExpectedKeyUnnormalized

type ErrExpectedKeyUnnormalized struct {
	Key           string
	ValueExpected string
}

func (ErrExpectedKeyUnnormalized) Error

type ErrStoreMissingKey

type ErrStoreMissingKey struct {
	// env-style key
	Key           string
	ValueExpected string
}

func (ErrStoreMissingKey) Error

func (e ErrStoreMissingKey) Error() string

type ErrStoreUnexpectedValue

type ErrStoreUnexpectedValue struct {
	// store-style key
	Key           string
	ValueExpected string
	ValueActual   string
}

func (ErrStoreUnexpectedValue) Error

func (e ErrStoreUnexpectedValue) Error() string

Jump to

Keyboard shortcuts

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