In Go, it’s dead simple to get the value from an environment variable:
fmt.Println(os.Getenv("HOME"))
But, sometimes you have default values… so you would have to do something
like this:
home := os.Getenv("HOME")
if home == "" {
home = "THE DEFAULT HOME"
}
fmt.Println(home)
If you need those valu…