Help us shape the future of Go! Take the 2026 Go Developer Survey

env

package module
v0.0.0-...-01717c8 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintGlobalSpec

func PrintGlobalSpec()

PrintGlobalSpec prints all environment variables for the program in lexicographically ascending order and returns.

func RegisterSpec

func RegisterSpec(s ...Spec)

RegisterSpec registers one or more environment variable specifications in the global specification.

Types

type Spec

type Spec []Var

Spec contains all environment variables that a component requires.

func GlobalSpec

func GlobalSpec() Spec

GlobalSpec is the global specification of all environment variables.

func (Spec) Resolve

func (s Spec) Resolve() (envs map[string]string, err error)

Resolve retrieves all environment variables required in the specification. If any required environment variable is not found it is added to the list of errors which is returned after all environment variables have been checked. If an environment variable is not specified by the user, the default value will be used (specified in `Value`). If this is not specified either, an empty string is used and an error will be returned for the empty environment variable if it is required.

type Var

type Var struct {
	Name     string
	Help     string
	Value    string
	Required bool
}

Var is a basic description of an environment variable.

Jump to

Keyboard shortcuts

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