package main
import "os"
func main() {
for _, env := range os.Environ() {
print(env, "\n")
}
}
os.Environ()
- returns list of all environment variablesfor _, env := range os.Environ()
- iterate over all environment variablesimport "os"
- importos
module to work with environment variables
group: env
package main
import "os"
func main() {
for _, env := range os.Environ() {
print(env, "\n")
}
}
USER=www-data
HOME=/var/www
PWD=/tmp