Go by Example: Environment Variables
Go by Example : Environment Variables
Environment variables are a universal mechanism for conveying configuration information to Unix programs . Let’s look at how to set, get, and list environment variables. | |
| |
| |
| |
To set a key/value pair, use
|
|
Use
|
|
Running the program shows that we pick up the value
for
|
|
The list of keys in the environment will depend on your particular machine. |
|
If we set
|
|
Next example: Logging .