title: Golang is it safe to switch cmd.Stdout
body: <p>I execute process with Go and write output to file (log file)</p>
  
  <pre><code>    cmd := exec.Command(path)
      cmd.Dir = dir
      t := time.Now()
      t1 := t.Format("20060102-150405")
  
      fs, err := os.Create(dir + "/var/log/" + t1 + ".std")
      if err == nil {
          cmd.Stdout = fs
      }
  </code></pre>
  
  <p>I wish to rotate logs and change log file daily 
  <a href="http://golang.org/pkg/os/exec/">http://golang.org/pkg/os/exec/</a></p>
  
  <pre><code>    // Stdout and Stderr specify the process's standard output and error.
      //
      // If either is nil, Run connects the corresponding file descriptor
      // to the null device (os.DevNull).
      //
      // If Stdout and Stderr are the same writer, at most one
      // goroutine at a time will call Write.
      Stdout io.Writer
      Stderr io.Writer
  </code></pre>
  
  <p>Is it safe to change cmd.Stdout variable daily from arbitary goroutine or I have to implement goroutine that will copy from Stdout to another file and switch files?</p>