
4

[Golang] Check if Environment Variable Exist
source link: http://siongui.github.io/2020/01/29/go-check-if-environment-variable-exist/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Golang] Check if Environment Variable Exist
January 29, 2020
Use os.LookupEnv in Go standard library to check if an environment variable exists. the following is an method to help you check:
import ( "os" ) func isEnvExist(key string) bool { if _, ok := os.LookupEnv(key); ok { return true } return false }
You can run example code by the following link:
References:
Author: Siong-Ui Te ∈ Category: Go
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK