File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88# getenv
99
10- Package getenv provides functionality for loading environment variables and parse them into go builtin types.
10+ Package getenv provides a simple way to get environment variables.
11+ It's type-safe and supports built-in types and slices of them.
1112
1213Types supported:
1314- string
@@ -60,6 +61,7 @@ Types supported:
6061EnvOrDefault retrieves the value of the environment variable named by the key.
6162If the variable is present in the environment the value will be parsed and returned.
6263Otherwise, the default value will be returned.
64+ The value returned will be of the same type as the default value.
6365
6466``` golang
6567package main
Original file line number Diff line number Diff line change 1- // Package getenv provides functionality for loading environment variables and parse them into go builtin types.
1+ // Package getenv provides a simple way to get environment variables.
2+ // It's type-safe and supports built-in types and slices of them.
23//
34// Types supported:
45// - string
@@ -53,6 +54,7 @@ import (
5354// EnvOrDefault retrieves the value of the environment variable named by the key.
5455// If the variable is present in the environment the value will be parsed and returned.
5556// Otherwise, the default value will be returned.
57+ // The value returned will be of the same type as the default value.
5658func EnvOrDefault [T internal.EnvParsable ](key string , defaultVal T , options ... option.Option ) T {
5759 w := internal .NewEnvParser (defaultVal )
5860
You can’t perform that action at this time.
0 commit comments