// set env var "FOO" to value "1" os.Setenv("FOO", "1") // will print "FOO: 1" fmt.Println("FOO:", os.Getenv("FOO"))