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
+9k Golang : Go as a script or running go with shebang/hashbang style
+23.9k Golang : Fix type interface{} has no field or no methods and type assertions example
+12.2k Golang : Pagination with go-paginator configuration example
+20k Golang : Convert(cast) bytes.Buffer or bytes.NewBuffer type to io.Reader
+11.1k Golang : Generate random elements without repetition or duplicate
+13.9k Golang : Convert spaces to tabs and back to spaces example
+10.9k Golang : Command line file upload program to server example
+6.3k Golang : Extract sub-strings
+7.5k Golang : Shuffle strings array
+15.9k Golang : Get current time from the Internet time server(ntp) example
+12.5k Golang : HTTP response JSON encoded data
+47.8k Golang : Convert int to byte array([]byte)