env

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(key string) bool

Bool calls os.Getenv(key) and parses the value as a bool. The following values return true: "1", "true", "yes", "y", "on", "ok"

func Duration

func Duration(key string) (time.Duration, error)

Duration is a shortcut for time.ParseDuration(os.Getenv(key)).

func Int

func Int(key string) (int, error)

Int is a shortcut for strconv.Atoi(os.Getenv(key)).

func String

func String(key string) string

String returns os.Getenv(key).

func Temp

func Temp(key string, val any) func()

Temp calls os.Setenv(key, fmt.Sprint(val)) and returns a function that restores the previous value of that environment variable.

Types

This section is empty.

Jump to

Keyboard shortcuts

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