env

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(value string) string

Expand returns value of convert with environment variable. Return environment variable if value start with "${" and end with "}". Return default value if environment variable is empty or not exist.

It accepts value formats "${env}" ,"${env||defaultValue}" , "defaultValue". Examples:

_ = Expand("${GOPATH}")
_ = Expand("${GOPATH||/usr/local/go}")
_ = Expand("hello")

func Get

func Get(names ...string) string

func GetBoolVal

func GetBoolVal(val *bool, names ...string)

func GetFloatVal

func GetFloatVal(val *float64, names ...string)

func GetIntVal

func GetIntVal(val *int, names ...string)

func GetWith

func GetWith(val *string, names ...string)

func Key

func Key(key string) string

func List

func List() map[string]string

func Lookup

func Lookup(key string) (string, bool)

func MustGet

func MustGet(names ...string) string

func Set

func Set(key, value string) error

func UnSetenv

func UnSetenv(key string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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