environment

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package environment is an abstraction that Ferrite uses to interact with the environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualNames

func EqualNames(a, b string) bool

EqualNames returns true if the given names refer to the same environment variable.

func Get

func Get(n string) string

Get returns the value of the environment variable with the given name.

func NormalizeName

func NormalizeName(n string) string

NormalizeName normalizes an environment variable name for use as a key within a map.

func Range

func Range(fn func(n, v string) bool)

Range calls fn for each environment variable.

It stops iterating if fn returns false. It returns true if iteration reached the end.

func RestoreSnapshot

func RestoreSnapshot(s *Snapshot)

RestoreSnapshot restores the environment to the state it was in when the given snapshot was taken.

func Set

func Set(n, v string)

Set sets the value of the environment variable with the given name, or panics if unable to do so.

func Unset

func Unset(n string)

Unset unsets the environment variable with the given name, or panics if unable to do so.

Types

type Snapshot

type Snapshot struct {
	// contains filtered or unexported fields
}

Snapshot is a snapshot of the environment.

func TakeSnapshot

func TakeSnapshot() *Snapshot

TakeSnapshot takes a snapshot of the variables within the environment.

Jump to

Keyboard shortcuts

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