title: reload or source /etc/enviornment file from golang code
body: <p>I have tried the source command from my go code,after i write env variables to the /etc/enviornment file.</p>
  
  <p>Below is the sample code.</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "io/ioutil"
      "log"
      "os"
      "os/exec"
      "strings"
  )
  
  func main() {
      address := "localhost:9090"
      file, err := os.OpenFile("/etc/environment", os.O_RDWR, 0644)
      defer file.Close()
      if err != nil {
          panic(err)
      }
      input, err := ioutil.ReadAll(file)
      if err != nil {
          log.Fatalln(err)
      }
  
      lines := strings.Split(string(input), "\n")
  
      for i, line := range lines {
          if strings.Contains(line, "HTTP_PROXY") {
              lines[i] = "HTTP_PROXY=" + address
          } else {
              if i == (len(lines) - 1) {
                  lines[i] = "HTTP_PROXY=" + address
              }
          }
      }
      output := strings.Join(lines, "\n")
      err = ioutil.WriteFile("/etc/environment", []byte(output), 0644)
      if err != nil {
          log.Fatalln(err)
      }
  
      cmd := exec.Command("bash", "-c", "source /etc/environment")
      cmd.Stdout = os.Stdout
      cmd.Stderr = os.Stderr
      err = cmd.Run()
      fmt.Println("cmd=================&gt;", cmd, err)
  
      if err != nil {
          fmt.Println(err)
      }
  }
  </code></pre>
  
  <p>It dint return any error</p>
  
  <p>But when i try to check my HTTP_PROXY  in using <code>env | grep -i proxy</code> I dont see it getting reflected.
  I can only see the change is done when it restart the system or run the source command again from another terminal.</p>
  
  <p>All i want is to change the os proxy from the go code without restarting the system.</p>
  
  <p>If there is any other approach to this please mention that as well.</p>