How to get an environment variable in Go? Posted on Mar 24, 2018 by Q A In QA In Go lang, how to get an environment variable? To get an environment variable (e.g. “VAR”) in GO: import "os" import "fmt" fmt.Println("VAR:", os.Getenv("VAR")) Read more: How to get an environment variable in Python? How to set and get an environment variable in C on Linux? How to get an environment variable in Python? How to set an environment variable in bash? How to set an environment variable in csh? How to get an environment variable in Bash? How to get an environment variable in Java? How to set up the Java environment in Linux?