Created
June 4, 2020 07:44
-
-
Save sumjha/b7cd72e3b1b24139a18a5f459295b2bf to your computer and use it in GitHub Desktop.
Check if a environment variable is set in Go (Golang)
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 ( | |
"fmt" | |
"os" | |
) | |
func main() { | |
val, present := os.LookupEnv("MyEnvVariable") | |
fmt.Printf("MyEnvVariable env variable present: %t\n", present) | |
fmt.Println(val) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment