Last active
October 27, 2020 17:43
-
-
Save andyneff/9e02194ee5ab4d5edcc88f332ae4be0e to your computer and use it in GitHub Desktop.
Simple program to print the environment variable names in order (apparently there is an order)
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 | |
// docker run -it --rm -v `pwd`:/src -w /src golang go build print_env.go | |
import ( | |
"fmt" | |
"os" | |
"strings" | |
) | |
func main() { | |
environment := os.Environ() | |
for i, env := range environment { | |
e := strings.SplitN(env, "=", 2) | |
fmt.Printf("% 3d) %s\n", i, e[0]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment