Golang : Get environment variable
Sometimes we need to get the environment variables for performing next task in our program. It is straight forward to do this in Go.
For example, to get the environment variable HOME.
Home := os.Getenv("HOME")
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+17.4k Unmarshal/Load CSV record into struct in Go
+16k Golang : Defer function inside init()
+12k Golang : How to get a user home directory path?
+32.1k Golang : Converting a negative number to positive number
+16.9k Golang : Get download file size
+22.9k Golang : Call function from another package
+5.9k Golang : Takes a plural word and makes it singular
+20.9k Golang : Read directory content with filepath.Walk()
+10.5k Golang : Sort and reverse sort a slice of runes
+5.2k Apt-get to install and uninstall Golang
+15.6k Golang : Capture stdout of a child process and act according to the result