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.5k Golang : Scramble and unscramble text message by randomly replacing words
+5.7k Fix fatal error: evacuation not done in time problem
+14.6k Golang : How to determine if user agent is a mobile device example
+5.9k Golang : Detect variable or constant type
+7.6k Golang : Detect sample rate, channels or latency with PortAudio
+5.8k Golang : Error handling methods
+5.1k Golang : Display packages names during compilation
+36.7k Golang : Validate IP address
+7.8k Golang : Command line ticker to show work in progress
+6.6k PHP : Shuffle to display different content or advertisement
+5.8k Get website traffic ranking with Similar Web or Alexa
+7.2k Restart Apache or Nginx web server without password prompt