Created
March 13, 2014 00:22
-
-
Save nickserv/9519543 to your computer and use it in GitHub Desktop.
List all environment variables in Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"fmt" | |
) | |
func main() { | |
for _, pair := range os.Environ() { | |
fmt.Println(pair) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@avnish30jn A process is "firewalled" from its parents and siblings. One process can have the same variable with a completely different value as another. A process only has access to its own envs (and the ones the parent exports). Were it not so, scripting would be... hell, in the worst way.