Documentation ¶
Overview ¶
Package env provides methods for working with environment variables
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Env ¶
Env is map with environment values
func Get ¶
func Get() Env
Get return key-value map with environment values
Example ¶
env := Get() // Print PATH environment variable fmt.Println(env["PATH"]) // Path return PATH variable as slice for i, p := range env.Path() { fmt.Printf("%d %s\n", i, p) } // You can use getters for different value formats fmt.Printf("Integer value %s = %d\n", "INT_VALUE", env.GetI("INT_VALUE")) fmt.Printf("Float value %s = %g\n", "FLOAT_VALUE", env.GetF("FLOAT_VALUE")) fmt.Printf("String value %s = %s\n", "STR_VALUE", env.GetS("STR_VALUE"))
Output:
Click to show internal directories.
Click to hide internal directories.