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
+8.8k Golang : GMail API create and send draft with simple upload attachment example
+13.6k Golang : How to determine if a year is leap year?
+10.9k Golang : Generate random elements without repetition or duplicate
+8.1k Golang : Emulate NumPy way of creating matrix example
+8.1k Golang : Oanda bot with Telegram and RSI example
+9.5k Golang : Eroding and dilating image with OpenCV example
+44.6k Golang : Use wildcard patterns with filepath.Glob() example
+9.5k Golang : Quadratic example
+19.7k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+22.7k Golang : simulate tail -f or read last line from log file example
+12.4k Golang : Exit, terminating or aborting a program