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
+9.6k Golang : Get local time and equivalent time in different time zone
+14.2k Golang : Delete certain files in a directory
+14.1k Golang : How do I get the local IP (non-loopback) address ?
+17.1k Golang : Logging with logrus
+3.1k Detect if Google Analytics and Developer Media are loaded properly or not
+18.5k Golang : How to count the number of repeated characters in a string?
+4.9k Golang : List all packages and search for certain package
+10.5k Golang : Sort and reverse sort a slice of runes
+8.8k Golang : Detect number of faces or vehicles in a photo
+4.8k Golang : Struct field tags and what is their purpose?
+18.2k Golang : Delete item from slice based on index/key position
+18k Golang : Execute shell command