envvar

package
v0.0.2-testing Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 3 Imported by: 1 module, 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 is the one way the CLI reads environment variables. Every variable the CLI reads goes through Get, Lookup, Bool or True, so tests can replace the whole environment with a map (see envvartest.Fake). The one exception is passing the whole environment to a child process (os.Environ), which is not a read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(key string) (value, ok bool)

Bool reads key as a boolean: 1/true/yes/on or 0/false/no/off, case-insensitively. ok is false for any other value, including unset or "".

func Get

func Get(key string) string

Get returns the value of key, or "" if it is not set.

func Lookup

func Lookup(key string) (string, bool)

Lookup returns the value of key and whether it is set.

func True

func True(key string) bool

True reports whether key holds a true boolean value.

func Use

func Use(l func(string) (string, bool)) (restore func())

Use replaces the environment the package reads until restore is called.

Types

type Map

type Map map[string]string

Map is an environment given as key/value pairs.

Directories

Path Synopsis
Package envvartest replaces the environment envvar reads in tests.
Package envvartest replaces the environment envvar reads in tests.

Jump to

Keyboard shortcuts

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