SoFunction
Updated on 2025-03-05

Methods for obtaining system environment variables in GO language

package main
import (
 "fmt"
"os" //We want to use the env in the os package
)
func main() {
//Retrieve the environment variable and return the value. If the variable does not exist, this will be empty.
 HOME:= ("HOME")
 (HOME)
 (("JAVA_HOME"))
}