[Golang] Check if Environment Variable Exist

Use os.LookupEnv in Go standard library to check if an environment variable exists. the following is an method to help you check:

import (

func isEnvExist(key string) bool {
      if _, ok := os.LookupEnv(key); ok {
              return true
      return false

You can run example code by the following link:

Run Code on Go Playground