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
+25.5k Golang : How to read integer value from standard input ?
+12.2k Golang : Extract part of string with regular expression
+19.9k Golang : How to get struct tag and use field name to retrieve data?
+7.3k Golang : Rot13 and Rot5 algorithms example
+17.8k Golang : Convert IPv4 address to decimal number(base 10) or integer
+6.9k Golang : Array mapping with Interface
+9.9k Golang : How to tokenize source code with text/scanner package?
+13.2k Golang : Increment string example
+13.9k Golang : Simple word wrap or line breaking example
+9.2k Golang : Accessing content anonymously with Tor
+15.2k Golang : ROT47 (Caesar cipher by 47 characters) example
+15.9k Golang : Loop each day of the current month example